aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-06-03 22:31:03 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-06-03 22:32:18 +0200
commit103831e2744f3b6f1b57e6e9aed3f0a14174fae3 (patch)
tree6d22ff934b94c581d94bbd4985de0450f61fb07e
parentf6da19d5b01b1dd33eb88406eef4636b0b088afb (diff)
downloadxK-103831e2744f3b6f1b57e6e9aed3f0a14174fae3.tar.gz
xK-103831e2744f3b6f1b57e6e9aed3f0a14174fae3.tar.xz
xK-103831e2744f3b6f1b57e6e9aed3f0a14174fae3.zip
degesch: process RPL_NAMREPLY modes properly
Updating information in "channel_user" when needed.
-rw-r--r--degesch.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/degesch.c b/degesch.c
index 5c90ddf..1c6e530 100644
--- a/degesch.c
+++ b/degesch.c
@@ -820,7 +820,7 @@ struct channel_user
LIST_HEADER (struct channel_user)
struct user *user; ///< Reference to user
- char *modes; ///< Op/voice/... characters
+ char *modes; ///< Ordered @+... characters
};
static struct channel_user *
@@ -4478,16 +4478,25 @@ irc_process_names (struct server *s, struct channel *channel)
{
const char *item = updates->vector[i];
const char *nick = item + strspn (item, s->irc_chanuser_prefixes);
+ char *modes = xstrndup (item, nick - item);
+
struct channel_user *channel_user = str_map_find (&map, nick);
if (!channel_user)
{
channel_user = channel_user_new ();
channel_user->user = irc_get_or_make_user (s, nick);
- channel_user->modes = xstrdup ("");
+ channel_user->modes = modes;
LIST_PREPEND (channel->users, channel_user);
}
-
- // TODO: update the user's modes
+ // If our idea of the user's modes disagrees with what the server's
+ // sent us (the most powerful modes differ), use the latter one
+ else if (channel_user->modes[0] != modes[0])
+ {
+ free (channel_user->modes);
+ channel_user->modes = modes;
+ }
+ else
+ free (modes);
}
// TODO: get rid of channel users missing from "updates":