mirror of
https://github.com/irssi/irssi.git
synced 2026-08-23 02:22:36 +02:00
Merge f74a78f1cb into f077280643
This commit is contained in:
commit
ca2b8d0c3c
1 changed files with 35 additions and 10 deletions
|
|
@ -32,6 +32,7 @@
|
|||
#include "irc-queries.h"
|
||||
#include "irc-servers-setup.h"
|
||||
#include "irc-servers.h"
|
||||
#include "channels-setup.h"
|
||||
#include "channel-rejoin.h"
|
||||
#include "servers-idle.h"
|
||||
#include "servers-reconnect.h"
|
||||
|
|
@ -55,6 +56,7 @@ void irc_servers_reconnect_init(void);
|
|||
void irc_servers_reconnect_deinit(void);
|
||||
|
||||
static int cmd_tag;
|
||||
static char *rejoin_channels_mode;
|
||||
|
||||
static int isnickflag_func(SERVER_REC *server, char flag)
|
||||
{
|
||||
|
|
@ -482,6 +484,11 @@ char *irc_server_get_channels(IRC_SERVER_REC *server)
|
|||
GSList *tmp;
|
||||
GString *chans, *keys;
|
||||
char *ret;
|
||||
rejoin_channels_mode = settings_get_str("rejoin_channels_on_reconnect");
|
||||
|
||||
if (rejoin_channels_mode == NULL || (g_ascii_strcasecmp(rejoin_channels_mode, "on") != 0 && g_ascii_strcasecmp(rejoin_channels_mode, "on") != 0 && g_ascii_strcasecmp(rejoin_channels_mode, "on") != 0))
|
||||
rejoin_channels_mode = g_strdup("on");
|
||||
|
||||
int use_keys;
|
||||
|
||||
g_return_val_if_fail(server != NULL, FALSE);
|
||||
|
|
@ -490,25 +497,40 @@ char *irc_server_get_channels(IRC_SERVER_REC *server)
|
|||
keys = g_string_new(NULL);
|
||||
use_keys = FALSE;
|
||||
|
||||
/* do we want to rejoin channels in the first place? */
|
||||
if(g_ascii_strcasecmp(rejoin_channels_mode, "off") == 0) {
|
||||
g_string_free(chans, TRUE);
|
||||
g_string_free(keys, TRUE);
|
||||
return g_strdup("");
|
||||
}
|
||||
|
||||
/* get currently joined channels */
|
||||
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
||||
CHANNEL_REC *channel = tmp->data;
|
||||
|
||||
g_string_append_printf(chans, "%s,", channel->name);
|
||||
g_string_append_printf(keys, "%s,", channel->key == NULL ? "x" :
|
||||
channel->key);
|
||||
if (channel->key != NULL)
|
||||
use_keys = TRUE;
|
||||
CHANNEL_SETUP_REC *setup = channel_setup_find(channel->name,
|
||||
channel->server->connrec->chatnet);
|
||||
if ((setup != NULL && setup->autojoin && g_ascii_strcasecmp(rejoin_channels_mode, "auto") == 0) || g_ascii_strcasecmp(rejoin_channels_mode, "on") == 0) {
|
||||
g_string_append_printf(chans, "%s,", channel->name);
|
||||
g_string_append_printf(keys, "%s,", channel->key == NULL ? "x" :
|
||||
channel->key);
|
||||
if (channel->key != NULL)
|
||||
use_keys = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* get also the channels that are in rejoin list */
|
||||
for (tmp = server->rejoin_channels; tmp != NULL; tmp = tmp->next) {
|
||||
REJOIN_REC *rec = tmp->data;
|
||||
CHANNEL_SETUP_REC *setup = channel_setup_find(rec->channel,
|
||||
server->tag);
|
||||
|
||||
g_string_append_printf(chans, "%s,", rec->channel);
|
||||
g_string_append_printf(keys, "%s,", rec->key == NULL ? "x" :
|
||||
rec->key);
|
||||
if (rec->key != NULL) use_keys = TRUE;
|
||||
if ((setup != NULL && setup->autojoin && g_ascii_strcasecmp(rejoin_channels_mode, "auto") == 0) || g_ascii_strcasecmp(rejoin_channels_mode, "on") == 0) {
|
||||
g_string_append_printf(chans, "%s,", rec->channel);
|
||||
g_string_append_printf(keys, "%s,", rec->key == NULL ? "x" :
|
||||
rec->key);
|
||||
|
||||
if (rec->key != NULL) use_keys = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (chans->len > 0) {
|
||||
|
|
@ -865,6 +887,7 @@ void irc_server_init_isupport(IRC_SERVER_REC *server)
|
|||
|
||||
void irc_servers_init(void)
|
||||
{
|
||||
settings_add_str("servers", "rejoin_channels_on_reconnect", "on");
|
||||
settings_add_str("misc", "usermode", DEFAULT_USER_MODE);
|
||||
settings_add_time("flood", "cmd_queue_speed", DEFAULT_CMD_QUEUE_SPEED);
|
||||
settings_add_int("flood", "cmds_max_at_once", DEFAULT_CMDS_MAX_AT_ONCE);
|
||||
|
|
@ -897,6 +920,8 @@ void irc_servers_deinit(void)
|
|||
{
|
||||
if (cmd_tag != -1)
|
||||
g_source_remove(cmd_tag);
|
||||
if (rejoin_channels_mode != NULL)
|
||||
g_free(rejoin_channels_mode);
|
||||
|
||||
signal_remove("server connected", (SIGNAL_FUNC) sig_connected);
|
||||
signal_remove("server disconnected", (SIGNAL_FUNC) sig_disconnected);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue