mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Fixed a bug where the channel list to join/rejoin on reconnect gets too long, not all channels will be joined. The channel list is splitted into multiple lines right now when it's too long. (http://bugs.irssi.org/index.php?id=108&do=details)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3746 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
c474f1a2a0
commit
c79e690e88
@ -70,9 +70,9 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
|
||||
IRC_CHANNEL_REC *chanrec;
|
||||
GString *outchans, *outkeys;
|
||||
char *channels, *keys, *key;
|
||||
char **chanlist, **keylist, **tmp, **tmpkey, *channel, *channame;
|
||||
char **chanlist, **keylist, **tmp, **tmpkey, **tmpstr, *channel, *channame;
|
||||
void *free_arg;
|
||||
int use_keys;
|
||||
int use_keys, cmdlen;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
g_return_if_fail(IS_IRC_SERVER(server) && server->connected);
|
||||
@ -90,7 +90,9 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
|
||||
|
||||
use_keys = *keys != '\0';
|
||||
tmpkey = keylist;
|
||||
for (tmp = chanlist; *tmp != NULL; tmp++) {
|
||||
tmp = chanlist;
|
||||
for (;; tmp++) {
|
||||
if (*tmp != NULL) {
|
||||
channel = ischannel(**tmp) ? g_strdup(*tmp) :
|
||||
g_strdup_printf("#%s", *tmp);
|
||||
|
||||
@ -118,8 +120,25 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
|
||||
|
||||
if (*tmpkey != NULL)
|
||||
tmpkey++;
|
||||
}
|
||||
|
||||
tmpstr = tmp;
|
||||
tmpstr++;
|
||||
cmdlen = outchans->len-1;
|
||||
|
||||
if (use_keys)
|
||||
cmdlen += outkeys->len;
|
||||
if (*tmpstr != NULL)
|
||||
cmdlen += ischannel(**tmpstr) ? strlen(*tmpstr) :
|
||||
strlen(*tmpstr)+1;
|
||||
if (*tmpkey != NULL)
|
||||
cmdlen += strlen(*tmpkey);
|
||||
|
||||
/* don't try to send too long lines
|
||||
make sure it's not longer than 510
|
||||
so 510 - strlen("JOIN ") = 505 */
|
||||
if (cmdlen < 505)
|
||||
continue;
|
||||
}
|
||||
if (outchans->len > 0) {
|
||||
g_string_truncate(outchans, outchans->len-1);
|
||||
g_string_truncate(outkeys, outkeys->len-1);
|
||||
@ -127,7 +146,12 @@ static void irc_channels_join(IRC_SERVER_REC *server, const char *data,
|
||||
use_keys ? "JOIN %s %s" : "JOIN %s",
|
||||
outchans->str, outkeys->str);
|
||||
}
|
||||
|
||||
cmdlen = 0;
|
||||
g_string_truncate(outchans,0);
|
||||
g_string_truncate(outkeys,0);
|
||||
if (*tmp == NULL || tmp[1] == NULL)
|
||||
break;
|
||||
}
|
||||
g_string_free(outchans, TRUE);
|
||||
g_string_free(outkeys, TRUE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user