summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-02-19 04:33:39 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-02-19 04:33:39 +0000
commitf453e84436dc6e452b1f1be40611d1b11c57051d (patch)
tree29b22d389522fdf0958cca75f86b79538509da7b /src
parent19dff227d804e17c85afb38e3621cd60856bc50e (diff)
downloadirssi-f453e84436dc6e452b1f1be40611d1b11c57051d.zip
/NETSPLIT prints nicks now sorted and prints @ or + before channel if
user was opped/voiced before split. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1251 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/irc/fe-netsplit.c33
-rw-r--r--src/fe-text/gui-windows.c14
2 files changed, 37 insertions, 10 deletions
diff --git a/src/fe-common/irc/fe-netsplit.c b/src/fe-common/irc/fe-netsplit.c
index 6919672f..513a1ec4 100644
--- a/src/fe-common/irc/fe-netsplit.c
+++ b/src/fe-common/irc/fe-netsplit.c
@@ -289,19 +289,39 @@ static void sig_netsplit_servers(void)
}
}
-static void split_print(const char *nick, NETSPLIT_REC *rec)
+static int split_equal(NETSPLIT_REC *n1, NETSPLIT_REC *n2)
+{
+ return g_strcasecmp(n1->nick, n2->nick);
+}
+
+static void split_get(void *key, NETSPLIT_REC *rec, GSList **list)
+{
+ *list = g_slist_insert_sorted(*list, rec,
+ (GCompareFunc) split_equal);
+}
+
+static void split_print(NETSPLIT_REC *rec)
{
NETSPLIT_CHAN_REC *chan;
+ char *chanstr;
chan = rec->channels->data;
+ chanstr = chan == NULL ? "" :
+ g_strconcat(chan->nick.op ? "@" :
+ (chan->nick.voice ? "+" : ""), chan->name, NULL);
+
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NETSPLITS_LINE,
- rec->nick, chan == NULL ? "" : chan->name,
- rec->server->server, rec->server->destserver);
+ rec->nick, chanstr, rec->server->server,
+ rec->server->destserver);
+
+ g_free(chanstr);
}
/* SYNTAX: NETSPLIT */
static void cmd_netsplit(const char *data, IRC_SERVER_REC *server)
{
+ GSList *list;
+
if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
@@ -312,7 +332,12 @@ static void cmd_netsplit(const char *data, IRC_SERVER_REC *server)
}
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NETSPLITS_HEADER);
- g_hash_table_foreach(server->splits, (GHFunc) split_print, NULL);
+
+ list = NULL;
+ g_hash_table_foreach(server->splits, (GHFunc) split_get, &list);
+ g_slist_foreach(list, (GFunc) split_print, NULL);
+ g_slist_free(list);
+
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NETSPLITS_FOOTER);
}
diff --git a/src/fe-text/gui-windows.c b/src/fe-text/gui-windows.c
index 6dfaa084..d591c69f 100644
--- a/src/fe-text/gui-windows.c
+++ b/src/fe-text/gui-windows.c
@@ -977,11 +977,10 @@ void gui_window_resize(WINDOW_REC *window, int ychange, int xchange)
}
}
-static int window_remove_linecache(void *key, LINE_CACHE_REC *cache, gpointer nowp)
+static int window_remove_linecache(void *key, LINE_CACHE_REC *cache,
+ time_t *now)
{
- time_t now = (time_t) GPOINTER_TO_INT(nowp);
-
- if (cache->last_access+LINE_CACHE_KEEP_TIME > now)
+ if (cache->last_access+LINE_CACHE_KEEP_TIME > *now)
return FALSE;
line_cache_destroy(NULL, cache);
@@ -991,12 +990,15 @@ static int window_remove_linecache(void *key, LINE_CACHE_REC *cache, gpointer no
static int sig_check_linecache(void)
{
GSList *tmp;
+ time_t now;
+ now = time(NULL);
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
WINDOW_REC *rec = tmp->data;
- g_hash_table_foreach_remove(WINDOW_GUI(rec)->line_cache, (GHRFunc) window_remove_linecache,
- GINT_TO_POINTER((int) time(NULL)));
+ g_hash_table_foreach_remove(WINDOW_GUI(rec)->line_cache,
+ (GHRFunc) window_remove_linecache,
+ &now);
}
return 1;
}