express: Added Status tab to display status messages.

Summary:
Just like in other IRC clients all the status messages now gets
displayed in the status tab. Checked x-chat and in the same way all the
messages gets displayed in the express also now.

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: devilhorns

Differential Revision: https://phab.enlightenment.org/D2478
This commit is contained in:
Srivardhan Hebbar 2015-05-11 10:04:01 -04:00 committed by Chris Michael
parent e0499cee00
commit 62ae35980b
3 changed files with 48 additions and 19 deletions

View File

@ -48,9 +48,10 @@ _callback_server_connected(Express_Network *net, const char *event EINA_UNUSED,
}
void
_callback_server_motd(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count EINA_UNUSED, void *data EINA_UNUSED)
_callback_server_motd(Express_Network *net EINA_UNUSED, const char *event EINA_UNUSED, const char *source, const char **params, unsigned int count, void *data EINA_UNUSED)
{
Channel *chl;
unsigned int i = 0;
/* DBG("Server Motd"); */
/* DBG("\tServer: %s", source); */
@ -59,9 +60,10 @@ _callback_server_motd(Express_Network *net EINA_UNUSED, const char *event EINA_U
/* DBG("\tMessage:"); */
/* DBG("\t%s", params[1]); */
if (!(chl = _window_channel_server_find(source))) return;
_channel_text_append(chl, NULL, params[1],
_row_color_simple_create(COLOR_SYSTEM));
if (!(chl = _window_channel_find("Status"))) return;
for (i = 1; i < count; i++)
_channel_text_append(chl, NULL, params[i],
_row_color_simple_create(COLOR_SYSTEM));
}
void
@ -110,10 +112,10 @@ _callback_channel_notice(Express_Network *net EINA_UNUSED, const char *event EIN
if (!strcmp(params[0], "*"))
{
if (!(chl = _window_channel_server_find(source)))
if (!(chl = _window_channel_find("Status")))
{
ERR("Could not find channel with server name: %s", source);
if (!(chl = _window_channel_find("Default")))
if (!(chl = _window_channel_find("Status")))
chl = _window_channel_active_get();
}
}
@ -295,9 +297,11 @@ _callback_user_join(Express_Network *net, const char *event EINA_UNUSED, const c
}
/* skip user join messages for our own nick */
if (!strcmp(source, express_network_nickname_get(net))) return;
if (!strcmp(source, express_network_nickname_get(net)))
snprintf(buff, sizeof(buff), "Now talking on %s\r\n", channel);
else
snprintf(buff, sizeof(buff), "%s has joined %s\r\n", source, channel);
snprintf(buff, sizeof(buff), "%s has joined %s\r\n", source, channel);
_channel_text_append(chl, "*", buff, _row_color_simple_create(COLOR_JOIN));
}

View File

@ -390,7 +390,7 @@ _window_create(void)
evas_object_show(_win->o_base);
/* try to create a default channel */
if ((chl = _window_channel_create("Default", NULL)))
if ((chl = _window_channel_create("Status", NULL)))
{
/* swallow channel background */
_window_channel_swallow(chl);
@ -901,7 +901,7 @@ _window_network_channels_create(Express_Network *net)
* TODO:
* NB: This COULD become a config option for 'server message window'
* and optionally be left open to display server messages */
/* _window_channel_destroy("Default"); */
/* _window_channel_destroy("Status"); */
/* } */
/* _window_channel_count_update(NULL); */
@ -941,7 +941,7 @@ _window_network_channels_destroy(Express_Network *net)
Channel *chl;
/* try to create a default channel */
if ((chl = _window_channel_create("Default", NULL)))
if ((chl = _window_channel_create("Status", NULL)))
{
/* swallow channel background */
_window_channel_swallow(chl);

View File

@ -125,16 +125,33 @@ _process_buffer(Express_Network *net, char *data, int length)
return;
}
if (code)
switch (code)
{
/* skip parts of the motd */
/* if ((code == 4) || (code == 5)) return; */
/* if ((code >= 252) && (code < 255)) return; */
/* if ((code == 265) || (code == 266)) return; */
/* DBG("Code: %d", code); */
//fprintf(stderr, "Code: %d\n", code);
if ((code <= 5) || (code == 372) || (code == 376) || (code == 422))
case 1:
case 2:
case 3:
case 4:
case 5:
case 250:
case 251:
case 252:
case 253:
case 254:
case 255:
case 265:
case 266:
case 372:
case 375:
case 376:
case 403:
case 422:
{
if (net->callbacks.motd)
(*net->callbacks.motd)(net, "MOTD", prefix, params, index,
@ -173,29 +190,37 @@ _process_buffer(Express_Network *net, char *data, int length)
/* wait until End of MOTD before identifying */
if (code == 376) express_network_nick_password_send(net);
}
else if (code == 332)
break;
case 332:
{
if (net->callbacks.topic)
(*net->callbacks.topic)(net, "TOPIC", prefix, params, index,
net->callbacks.data);
}
else if (code == 333)
break;
case 333:
{
if (net->callbacks.topic_time)
(*net->callbacks.topic_time)(net, "TOPIC_TIME", prefix, params,
index, net->callbacks.data);
}
else if (code == 353)
break;
case 353:
{
if (net->callbacks.channel_names)
(*net->callbacks.channel_names)(net, "NAMES", prefix, params,
index, net->callbacks.data);
}
else if (net->callbacks.numeric)
break;
default:
if (*net->callbacks.numeric)
(*net->callbacks.numeric)(net, code, prefix, params, index,
net->callbacks.data);
case 0:
break;
}
else
if (!code)
{
/* DBG("Command: %s", cmd); */