diff --git a/src/bin/callbacks.c b/src/bin/callbacks.c index 94ba5d7..38c78bd 100644 --- a/src/bin/callbacks.c +++ b/src/bin/callbacks.c @@ -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)); } diff --git a/src/bin/window.c b/src/bin/window.c index f9c1441..3c315d3 100644 --- a/src/bin/window.c +++ b/src/bin/window.c @@ -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); diff --git a/src/lib/network.c b/src/lib/network.c index 229c10b..26feb98 100644 --- a/src/lib/network.c +++ b/src/lib/network.c @@ -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); */