1
0
mirror of https://github.com/irssi/irssi.git synced 2025-02-02 15:08:01 -05:00

While waiting for more netsplits/netjoins, if anything else is printed

to screen, print the current netsplit/netjoin messages before that text.
not tested, hope it works ;)


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@900 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-11-30 01:44:07 +00:00 committed by cras
parent 18a918791e
commit 6d88345f30
2 changed files with 55 additions and 12 deletions

View File

@ -228,6 +228,20 @@ static void print_netjoins(NETJOIN_SERVER_REC *server)
netjoin_server_remove(server); netjoin_server_remove(server);
} }
/* something is going to be printed to screen, print our current netsplit
message before it. */
static void sig_print_starting(void)
{
GSList *tmp;
for (tmp = joinservers; tmp != NULL; tmp = tmp->next) {
NETJOIN_SERVER_REC *server = tmp->data;
if (server->netjoins != NULL)
print_netjoins(server);
}
}
static int sig_check_netjoins(void) static int sig_check_netjoins(void)
{ {
GSList *tmp, *next; GSList *tmp, *next;
@ -253,6 +267,7 @@ static int sig_check_netjoins(void)
if (joinservers == NULL) { if (joinservers == NULL) {
g_source_remove(join_tag); g_source_remove(join_tag);
signal_remove("print starting", (SIGNAL_FUNC) sig_print_starting);
join_tag = -1; join_tag = -1;
} }
return 1; return 1;
@ -286,6 +301,7 @@ static void msg_join(IRC_SERVER_REC *server, const char *channel,
if (join_tag == -1) { if (join_tag == -1) {
join_tag = g_timeout_add(1000, (GSourceFunc) join_tag = g_timeout_add(1000, (GSourceFunc)
sig_check_netjoins, NULL); sig_check_netjoins, NULL);
signal_add("print starting", (SIGNAL_FUNC) sig_print_starting);
} }
if (netjoin == NULL) if (netjoin == NULL)
@ -390,7 +406,10 @@ void fe_netjoin_deinit(void)
{ {
while (joinservers != NULL) while (joinservers != NULL)
netjoin_server_remove(joinservers->data); netjoin_server_remove(joinservers->data);
if (join_tag != -1) g_source_remove(join_tag); if (join_tag != -1) {
g_source_remove(join_tag);
signal_remove("print starting", (SIGNAL_FUNC) sig_print_starting);
}
signal_remove("setup changed", (SIGNAL_FUNC) read_settings); signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
} }

View File

@ -140,7 +140,7 @@ static void get_server_splits(void *key, NETSPLIT_REC *split,
} }
} }
static void print_splits(IRC_SERVER_REC *server, TEMP_SPLIT_REC *rec) static void print_server_splits(IRC_SERVER_REC *server, TEMP_SPLIT_REC *rec)
{ {
GString *destservers; GString *destservers;
char *sourceserver; char *sourceserver;
@ -191,17 +191,10 @@ static void temp_split_chan_free(TEMP_SPLIT_CHAN_REC *rec)
g_free(rec); g_free(rec);
} }
static int check_server_splits(IRC_SERVER_REC *server) static void print_splits(IRC_SERVER_REC *server)
{ {
TEMP_SPLIT_REC temp; TEMP_SPLIT_REC temp;
GSList *servers; GSList *servers;
time_t last;
g_return_val_if_fail(IS_IRC_SERVER(server), FALSE);
last = get_last_split(server);
if (time(NULL)-last < SPLIT_WAIT_TIME)
return FALSE;
servers = g_slist_copy(server->split_servers); servers = g_slist_copy(server->split_servers);
while (servers != NULL) { while (servers != NULL) {
@ -215,17 +208,43 @@ static int check_server_splits(IRC_SERVER_REC *server)
g_hash_table_foreach(server->splits, g_hash_table_foreach(server->splits,
(GHFunc) get_server_splits, &temp); (GHFunc) get_server_splits, &temp);
print_splits(server, &temp); print_server_splits(server, &temp);
g_slist_foreach(temp.channels, g_slist_foreach(temp.channels,
(GFunc) temp_split_chan_free, NULL); (GFunc) temp_split_chan_free, NULL);
g_slist_free(temp.servers); g_slist_free(temp.servers);
g_slist_free(temp.channels); g_slist_free(temp.channels);
} }
}
static int check_server_splits(IRC_SERVER_REC *server)
{
time_t last;
g_return_val_if_fail(IS_IRC_SERVER(server), FALSE);
last = get_last_split(server);
if (time(NULL)-last < SPLIT_WAIT_TIME)
return FALSE;
print_splits(server);
return TRUE; return TRUE;
} }
/* something is going to be printed to screen, print our current netsplit
message before it. */
static void sig_print_starting(void)
{
GSList *tmp;
for (tmp = servers; tmp != NULL; tmp = tmp->next) {
IRC_SERVER_REC *rec = tmp->data;
if (IS_IRC_SERVER(rec) && rec->split_servers != NULL)
print_splits(rec);
}
}
static int sig_check_splits(void) static int sig_check_splits(void)
{ {
GSList *tmp; GSList *tmp;
@ -246,6 +265,7 @@ static int sig_check_splits(void)
if (stop) { if (stop) {
g_source_remove(split_tag); g_source_remove(split_tag);
signal_remove("print starting", (SIGNAL_FUNC) sig_print_starting);
split_tag = -1; split_tag = -1;
} }
return 1; return 1;
@ -257,6 +277,7 @@ static void sig_netsplit_servers(void)
split_tag = g_timeout_add(1000, split_tag = g_timeout_add(1000,
(GSourceFunc) sig_check_splits, (GSourceFunc) sig_check_splits,
NULL); NULL);
signal_add("print starting", (SIGNAL_FUNC) sig_print_starting);
} }
} }
@ -308,7 +329,10 @@ void fe_netsplit_init(void)
void fe_netsplit_deinit(void) void fe_netsplit_deinit(void)
{ {
if (split_tag != -1) g_source_remove(split_tag); if (split_tag != -1) {
g_source_remove(split_tag);
signal_remove("print starting", (SIGNAL_FUNC) sig_print_starting);
}
signal_remove("netsplit add", (SIGNAL_FUNC) sig_netsplit_servers); signal_remove("netsplit add", (SIGNAL_FUNC) sig_netsplit_servers);
signal_remove("setup changed", (SIGNAL_FUNC) read_settings); signal_remove("setup changed", (SIGNAL_FUNC) read_settings);