handle parsing irc NAMES command

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2015-01-30 14:54:35 -05:00
parent f07b950679
commit d0765d9189
1 changed files with 24 additions and 11 deletions

View File

@ -136,15 +136,16 @@ void
_callback_channel_names(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source EINA_UNUSED, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
{
Channel *chl = NULL;
/* char buff[PATH_MAX]; */
char **users;
unsigned int n = 0, i = 0;
DBG("Channel Names: %s", params[0]);
DBG("\tCount: %d", count);
DBG("\tUser: %s", source);
DBG("\tMessage:");
DBG("\t%s", params[1]); // trash (@ or =)
DBG("\t%s", params[2]); // channel name
DBG("\t%s", params[3]); // names
/* DBG("Channel Names: %s", params[0]); */
/* DBG("\tCount: %d", count); */
/* DBG("\tUser: %s", source); */
/* DBG("\tMessage:"); */
/* DBG("\t%s", params[1]); */
/* DBG("\t%s", params[2]); */
/* DBG("\t%s", params[3]); */
if (!(chl = _window_channel_find(params[2]))) return;
@ -153,9 +154,21 @@ _callback_channel_names(Express_Network *net EINA_UNUSED, const char *event EINA
else
_channel_userlist_hide(chl);
/* snprintf(buff, sizeof(buff), "Topic for %s set by %s at %s\r\n", */
/* params[1], params[2], strtime); */
/* _channel_text_append(chl, NULL, buff); */
users = eina_str_split_full(params[3], " ", -1, &n);
for (; i < n; i++)
{
if (users[i][0] == '@')
{
users[i]++;
_channel_userlist_user_append(chl, users[i], EINA_TRUE);
}
else
_channel_userlist_user_append(chl, users[i], EINA_FALSE);
}
_channel_userlist_go(chl);
free(users[0]);
free(users);
}
void