Merges from Irssi CVS.
[runtime.git] / apps / irssi / src / fe-common / core / fe-channels.c
index fe41ea3004b8d5a7fbf4ac603c39c83bcc77b9f9..27ad4365c0923831a163cdcdc97586bd1e2a19ab 100644 (file)
@@ -67,7 +67,7 @@ static void signal_channel_destroyed(CHANNEL_REC *channel)
        window_item_destroy((WI_ITEM_REC *) channel);
 
        if (channel->joined && !channel->left &&
-           channel->server != NULL) {
+           !channel->server->disconnected) {
                /* kicked out from channel */
                window_bind_add(window, channel->server->tag,
                                channel->name);
@@ -132,21 +132,12 @@ static void cmd_join(const char *data, SERVER_REC *server)
        if (channel == NULL)
                return;
 
+       /* already joined to channel, set it active */
         window = window_item_window(channel);
+       if (window != active_win)
+               window_set_active(window);
 
-       if (window == active_win) {
-               /* channel is in active window, set it active */
-               window_item_set_active(active_win,
-                                      (WI_ITEM_REC *) channel);
-       } else {
-               /* notify user how to move the channel to active
-                  window. this was used to be done automatically
-                  but it just confused everyone who did it
-                  accidentally */
-               printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
-                                  TXT_CHANNEL_MOVE_NOTIFY, channel->name,
-                                  window->refnum);
-       }
+       window_item_set_active(active_win, (WI_ITEM_REC *) channel);
 }
 
 static void cmd_wjoin_post(const char *data)
@@ -437,7 +428,7 @@ static void display_sorted_nicks(CHANNEL_REC *channel, GSList *nicklist)
                }
        }
 
-       if (str->len != 0) {
+       if (str->len > strlen(prefix_format)) {
                printtext(channel->server, channel->name,
                          MSGLEVEL_CLIENTCRAP, "%s", str->str);
        }
@@ -490,13 +481,13 @@ void fe_channels_nicklist(CHANNEL_REC *channel, int flags)
        /* display the nicks */
         if ((flags & CHANNEL_NICKLIST_FLAG_COUNT) == 0) {
                printformat(channel->server, channel->name,
-                           MSGLEVEL_CRAP, TXT_NAMES, channel->name, "");
+                           MSGLEVEL_CLIENTCRAP, TXT_NAMES, channel->name, nicks, ops, halfops, voices, normal);
                display_sorted_nicks(channel, sorted);
        }
        g_slist_free(sorted);
 
        printformat(channel->server, channel->name,
-                   MSGLEVEL_CRAP, TXT_ENDOFNAMES,
+                   MSGLEVEL_CLIENTNOTICE, TXT_ENDOFNAMES,
                    channel->name, nicks, ops, halfops, voices, normal);
 }
 
@@ -585,7 +576,14 @@ static void cmd_cycle(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
        joindata = chanrec->get_join_data(chanrec);
        window_bind_add(window_item_window(chanrec),
                        chanrec->server->tag, chanrec->name);
-        channel_destroy(chanrec);
+
+       /* FIXME: kludgy kludgy... */
+       signal_emit("command part", 3, data, server, item);
+
+       if (g_slist_find(channels, chanrec) != NULL) {
+               chanrec->left = TRUE;
+               channel_destroy(chanrec);
+       }
 
        server->channels_join(server, joindata, FALSE);
        g_free(joindata);