1
0
mirror of https://github.com/irssi/irssi.git synced 2024-08-04 03:34:18 -04:00

/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
This commit is contained in:
Timo Sirainen 2001-02-19 04:33:39 +00:00 committed by cras
parent 19dff227d8
commit f453e84436
2 changed files with 37 additions and 10 deletions

View File

@ -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; NETSPLIT_CHAN_REC *chan;
char *chanstr;
chan = rec->channels->data; 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, printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NETSPLITS_LINE,
rec->nick, chan == NULL ? "" : chan->name, rec->nick, chanstr, rec->server->server,
rec->server->server, rec->server->destserver); rec->server->destserver);
g_free(chanstr);
} }
/* SYNTAX: NETSPLIT */ /* SYNTAX: NETSPLIT */
static void cmd_netsplit(const char *data, IRC_SERVER_REC *server) static void cmd_netsplit(const char *data, IRC_SERVER_REC *server)
{ {
GSList *list;
if (!IS_IRC_SERVER(server) || !server->connected) if (!IS_IRC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_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); 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); printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, IRCTXT_NETSPLITS_FOOTER);
} }

View File

@ -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; return FALSE;
line_cache_destroy(NULL, cache); 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) static int sig_check_linecache(void)
{ {
GSList *tmp; GSList *tmp;
time_t now;
now = time(NULL);
for (tmp = windows; tmp != NULL; tmp = tmp->next) { for (tmp = windows; tmp != NULL; tmp = tmp->next) {
WINDOW_REC *rec = tmp->data; WINDOW_REC *rec = tmp->data;
g_hash_table_foreach_remove(WINDOW_GUI(rec)->line_cache, (GHRFunc) window_remove_linecache, g_hash_table_foreach_remove(WINDOW_GUI(rec)->line_cache,
GINT_TO_POINTER((int) time(NULL))); (GHRFunc) window_remove_linecache,
&now);
} }
return 1; return 1;
} }