mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 00:33:13 +02:00
irc: add optional server in info "irc_is_channel" (before channel name) (bug #35124), add optional server in info_hashtable "irc_message_parse"
This commit is contained in:
@@ -368,11 +368,11 @@ irc_channel_search (struct t_irc_server *server, const char *channel_name)
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_channel_is_channel: returns 1 if string is channel
|
||||
* irc_channel_is_channel: returns 1 if string is a channel for given server
|
||||
*/
|
||||
|
||||
int
|
||||
irc_channel_is_channel (const char *string)
|
||||
irc_channel_is_channel (struct t_irc_server *server, const char *string)
|
||||
{
|
||||
char first_char[2];
|
||||
|
||||
@@ -381,7 +381,10 @@ irc_channel_is_channel (const char *string)
|
||||
|
||||
first_char[0] = string[0];
|
||||
first_char[1] = '\0';
|
||||
return (strpbrk (first_char, IRC_CHANNEL_PREFIX)) ? 1 : 0;
|
||||
return (strpbrk (first_char,
|
||||
(server && server->chantypes) ?
|
||||
server->chantypes : IRC_CHANNEL_DEFAULT_CHANTYPES)) ?
|
||||
1 : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef __WEECHAT_IRC_CHANNEL_H
|
||||
#define __WEECHAT_IRC_CHANNEL_H 1
|
||||
|
||||
#define IRC_CHANNEL_PREFIX "#&+!"
|
||||
#define IRC_CHANNEL_DEFAULT_CHANTYPES "#&+!"
|
||||
|
||||
/* channel types */
|
||||
#define IRC_CHANNEL_TYPE_UNKNOWN -1
|
||||
@@ -87,7 +87,8 @@ extern void irc_channel_free (struct t_irc_server *server,
|
||||
extern void irc_channel_free_all (struct t_irc_server *server);
|
||||
extern struct t_irc_channel *irc_channel_search (struct t_irc_server *server,
|
||||
const char *channel_name);
|
||||
extern int irc_channel_is_channel (const char *string);
|
||||
extern int irc_channel_is_channel (struct t_irc_server *server,
|
||||
const char *string);
|
||||
extern void irc_channel_remove_away (struct t_irc_server *server,
|
||||
struct t_irc_channel *channel);
|
||||
extern void irc_channel_check_away (struct t_irc_server *server,
|
||||
|
||||
@@ -640,7 +640,7 @@ irc_command_ban (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
if (irc_channel_is_channel (argv[1]))
|
||||
if (irc_channel_is_channel (ptr_server, argv[1]))
|
||||
{
|
||||
pos_channel = argv[1];
|
||||
pos_args = 2;
|
||||
@@ -1002,7 +1002,7 @@ irc_command_cycle (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
if (irc_channel_is_channel (argv[1]))
|
||||
if (irc_channel_is_channel (ptr_server, argv[1]))
|
||||
{
|
||||
channel_name = argv[1];
|
||||
pos_args = argv_eol[2];
|
||||
@@ -1855,7 +1855,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
|
||||
if (manual_join)
|
||||
{
|
||||
snprintf (new_args, length, "%s%s",
|
||||
(irc_channel_is_channel (channels[0])) ? "" : "#",
|
||||
(irc_channel_is_channel (server, channels[0])) ? "" : "#",
|
||||
channels[0]);
|
||||
ptr_channel = irc_channel_search (server, new_args);
|
||||
if (ptr_channel)
|
||||
@@ -1871,7 +1871,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
|
||||
if (i > 0)
|
||||
strcat (new_args, ",");
|
||||
if (((num_channels > 1) || (strcmp (channels[i], "0") != 0))
|
||||
&& !irc_channel_is_channel (channels[i]))
|
||||
&& !irc_channel_is_channel (server, channels[i]))
|
||||
{
|
||||
strcat (new_args, "#");
|
||||
}
|
||||
@@ -1959,7 +1959,7 @@ irc_command_kick (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
if (irc_channel_is_channel (argv[1]))
|
||||
if (irc_channel_is_channel (ptr_server, argv[1]))
|
||||
{
|
||||
if (argc < 3)
|
||||
{
|
||||
@@ -2033,7 +2033,7 @@ irc_command_kickban (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
if (irc_channel_is_channel (argv[1]))
|
||||
if (irc_channel_is_channel (ptr_server, argv[1]))
|
||||
{
|
||||
if (argc < 3)
|
||||
{
|
||||
@@ -2540,7 +2540,7 @@ irc_command_msg (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (irc_channel_is_channel (targets[i]))
|
||||
if (irc_channel_is_channel (ptr_server, targets[i]))
|
||||
{
|
||||
ptr_channel = irc_channel_search (ptr_server,
|
||||
targets[i]);
|
||||
@@ -2763,7 +2763,7 @@ irc_command_notice (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
IRC_COMMAND_CHECK_SERVER("notice", 1);
|
||||
is_channel = 0;
|
||||
if (((argv[arg_target][0] == '@') || (argv[arg_target][0] == '+'))
|
||||
&& irc_channel_is_channel (argv[arg_target] + 1))
|
||||
&& irc_channel_is_channel (ptr_server, argv[arg_target] + 1))
|
||||
{
|
||||
ptr_channel = irc_channel_search (ptr_server, argv[arg_target] + 1);
|
||||
is_channel = 1;
|
||||
@@ -3117,7 +3117,7 @@ irc_command_part (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
if (irc_channel_is_channel (argv[1]))
|
||||
if (irc_channel_is_channel (ptr_server, argv[1]))
|
||||
{
|
||||
channel_name = argv[1];
|
||||
pos_args = argv_eol[2];
|
||||
@@ -4236,7 +4236,7 @@ irc_command_topic (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
if (irc_channel_is_channel (argv[1]))
|
||||
if (irc_channel_is_channel (ptr_server, argv[1]))
|
||||
{
|
||||
channel_name = argv[1];
|
||||
new_topic = argv_eol[2];
|
||||
@@ -4334,7 +4334,7 @@ irc_command_unban (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
if (irc_channel_is_channel (argv[1]))
|
||||
if (irc_channel_is_channel (ptr_server, argv[1]))
|
||||
{
|
||||
pos_channel = argv[1];
|
||||
pos_args = 2;
|
||||
@@ -4538,7 +4538,7 @@ irc_command_wallchops (void *data, struct t_gui_buffer *buffer, int argc,
|
||||
|
||||
if (argc > 1)
|
||||
{
|
||||
if (irc_channel_is_channel (argv[1]))
|
||||
if (irc_channel_is_channel (ptr_server, argv[1]))
|
||||
{
|
||||
pos_channel = argv[1];
|
||||
pos_args = 2;
|
||||
|
||||
@@ -210,7 +210,7 @@ irc_ignore_check (struct t_irc_server *server, const char *channel,
|
||||
server_match = 0;
|
||||
channel_match = 0;
|
||||
|
||||
if (!server || (strcmp (ptr_ignore->server, "*") == 0))
|
||||
if (strcmp (ptr_ignore->server, "*") == 0)
|
||||
server_match = 1;
|
||||
else
|
||||
server_match = (weechat_strcasecmp (ptr_ignore->server,
|
||||
@@ -220,7 +220,7 @@ irc_ignore_check (struct t_irc_server *server, const char *channel,
|
||||
channel_match = 1;
|
||||
else
|
||||
{
|
||||
if (irc_channel_is_channel (channel))
|
||||
if (irc_channel_is_channel (server, channel))
|
||||
{
|
||||
channel_match = (weechat_strcasecmp (ptr_ignore->channel,
|
||||
channel) == 0);
|
||||
|
||||
+32
-18
@@ -70,7 +70,7 @@ irc_info_get_info_cb (void *data, const char *info_name,
|
||||
const char *arguments)
|
||||
{
|
||||
char *pos_comma, *pos_comma2, *server, *channel, *host;
|
||||
const char *nick, *isupport_value;
|
||||
const char *nick, *pos_channel, *isupport_value;
|
||||
static char str_true[2] = "1";
|
||||
struct t_irc_server *ptr_server;
|
||||
struct t_irc_channel *ptr_channel;
|
||||
@@ -80,7 +80,20 @@ irc_info_get_info_cb (void *data, const char *info_name,
|
||||
|
||||
if (weechat_strcasecmp (info_name, "irc_is_channel") == 0)
|
||||
{
|
||||
if (irc_channel_is_channel (arguments))
|
||||
ptr_server = NULL;
|
||||
pos_channel = arguments;
|
||||
pos_comma = strchr (arguments, ',');
|
||||
if (pos_comma)
|
||||
{
|
||||
pos_channel = pos_comma + 1;
|
||||
server = weechat_strndup (arguments, pos_comma - arguments);
|
||||
if (server)
|
||||
{
|
||||
ptr_server = irc_server_search (server);
|
||||
free (server);
|
||||
}
|
||||
}
|
||||
if (irc_channel_is_channel (ptr_server, pos_channel))
|
||||
return str_true;
|
||||
return NULL;
|
||||
}
|
||||
@@ -135,11 +148,13 @@ irc_info_get_info_cb (void *data, const char *info_name,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (irc_channel_is_channel (arguments))
|
||||
channel = strdup (arguments);
|
||||
else
|
||||
if (irc_server_search (arguments))
|
||||
server = strdup (arguments);
|
||||
else
|
||||
channel = strdup (arguments);
|
||||
}
|
||||
if (server)
|
||||
ptr_server = irc_server_search (server);
|
||||
|
||||
/*
|
||||
* replace channel by nick in host if channel is not a channel
|
||||
@@ -147,7 +162,7 @@ irc_info_get_info_cb (void *data, const char *info_name,
|
||||
*/
|
||||
if (channel && host)
|
||||
{
|
||||
if (!irc_channel_is_channel (channel))
|
||||
if (!irc_channel_is_channel (ptr_server, channel))
|
||||
{
|
||||
free (channel);
|
||||
channel = NULL;
|
||||
@@ -159,12 +174,8 @@ irc_info_get_info_cb (void *data, const char *info_name,
|
||||
}
|
||||
|
||||
/* search for server or channel buffer */
|
||||
if (server)
|
||||
{
|
||||
ptr_server = irc_server_search (server);
|
||||
if (ptr_server && channel)
|
||||
ptr_channel = irc_channel_search (ptr_server, channel);
|
||||
}
|
||||
if (server && ptr_server && channel)
|
||||
ptr_channel = irc_channel_search (ptr_server, channel);
|
||||
|
||||
if (server)
|
||||
free (server);
|
||||
@@ -252,10 +263,12 @@ irc_info_get_info_hashtable_cb (void *data, const char *info_name,
|
||||
|
||||
if (weechat_strcasecmp (info_name, "irc_message_parse") == 0)
|
||||
{
|
||||
server = weechat_hashtable_get (hashtable, "server");
|
||||
ptr_server = (server) ? irc_server_search (server) : NULL;
|
||||
message = weechat_hashtable_get (hashtable, "message");
|
||||
if (message)
|
||||
{
|
||||
value = irc_message_parse_to_hashtable (message);
|
||||
value = irc_message_parse_to_hashtable (ptr_server, message);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -567,8 +580,8 @@ irc_info_init ()
|
||||
{
|
||||
/* info hooks */
|
||||
weechat_hook_info ("irc_is_channel",
|
||||
N_("1 if string is a valid IRC channel name"),
|
||||
N_("channel name"),
|
||||
N_("1 if string is a valid IRC channel name for server"),
|
||||
N_("server,channel (server is optional)"),
|
||||
&irc_info_get_info_cb, NULL);
|
||||
weechat_hook_info ("irc_is_nick",
|
||||
N_("1 if string is a valid IRC nick name"),
|
||||
@@ -606,7 +619,8 @@ irc_info_init ()
|
||||
/* info_hashtable hooks */
|
||||
weechat_hook_info_hashtable ("irc_message_parse",
|
||||
N_("parse an IRC message"),
|
||||
N_("\"message\": IRC message"),
|
||||
N_("\"message\": IRC message, "
|
||||
"\"server\": server name (optional)"),
|
||||
/* TRANSLATORS: please do not translate key names (enclosed by quotes) */
|
||||
N_("\"nick\": nick, \"host\": host, "
|
||||
"\"command\": command, \"channel\": channel, "
|
||||
@@ -614,8 +628,8 @@ irc_info_init ()
|
||||
&irc_info_get_info_hashtable_cb, NULL);
|
||||
weechat_hook_info_hashtable ("irc_message_split",
|
||||
N_("split an IRC message (to fit in 512 bytes)"),
|
||||
N_("\"message\": IRC message, \"server\": server "
|
||||
"name (optional)"),
|
||||
N_("\"message\": IRC message, "
|
||||
"\"server\": server name (optional)"),
|
||||
/* TRANSLATORS: please do not translate key names (enclosed by quotes) */
|
||||
N_("\"msg1\" ... \"msgN\": messages to send "
|
||||
"(without final \"\\r\\n\"), "
|
||||
|
||||
@@ -37,8 +37,9 @@
|
||||
*/
|
||||
|
||||
void
|
||||
irc_message_parse (const char *message, char **nick, char **host,
|
||||
char **command, char **channel, char **arguments)
|
||||
irc_message_parse (struct t_irc_server *server, const char *message,
|
||||
char **nick, char **host, char **command, char **channel,
|
||||
char **arguments)
|
||||
{
|
||||
const char *pos, *pos2, *pos3, *pos4, *pos5;
|
||||
|
||||
@@ -108,7 +109,7 @@ irc_message_parse (const char *message, char **nick, char **host,
|
||||
*arguments = strdup (pos2);
|
||||
if (pos2[0] != ':')
|
||||
{
|
||||
if (irc_channel_is_channel (pos2))
|
||||
if (irc_channel_is_channel (server, pos2))
|
||||
{
|
||||
pos3 = strchr (pos2, ' ');
|
||||
if (channel)
|
||||
@@ -137,7 +138,7 @@ irc_message_parse (const char *message, char **nick, char **host,
|
||||
{
|
||||
pos3++;
|
||||
}
|
||||
if (irc_channel_is_channel (pos3))
|
||||
if (irc_channel_is_channel (server, pos3))
|
||||
{
|
||||
pos5 = strchr (pos3, ' ');
|
||||
if (channel)
|
||||
@@ -172,13 +173,15 @@ irc_message_parse (const char *message, char **nick, char **host,
|
||||
*/
|
||||
|
||||
struct t_hashtable *
|
||||
irc_message_parse_to_hashtable (const char *message)
|
||||
irc_message_parse_to_hashtable (struct t_irc_server *server,
|
||||
const char *message)
|
||||
{
|
||||
char *nick, *host, *command, *channel, *arguments;
|
||||
char empty_str[1] = { '\0' };
|
||||
struct t_hashtable *hashtable;
|
||||
|
||||
irc_message_parse (message, &nick, &host, &command, &channel, &arguments);
|
||||
irc_message_parse (server, message, &nick, &host, &command, &channel,
|
||||
&arguments);
|
||||
|
||||
hashtable = weechat_hashtable_new (8,
|
||||
WEECHAT_HASHTABLE_STRING,
|
||||
@@ -815,7 +818,7 @@ irc_message_split (struct t_irc_server *server, const char *message)
|
||||
*/
|
||||
if (index_args + 2 <= argc - 1)
|
||||
{
|
||||
if (irc_channel_is_channel (argv[index_args + 1]))
|
||||
if (irc_channel_is_channel (server, argv[index_args + 1]))
|
||||
{
|
||||
snprintf (target, sizeof (target), "%s %s",
|
||||
argv[index_args], argv[index_args + 1]);
|
||||
|
||||
@@ -23,10 +23,11 @@
|
||||
struct t_irc_server;
|
||||
struct t_irc_channel;
|
||||
|
||||
extern void irc_message_parse (const char *message, char **nick, char **host,
|
||||
char **command, char **channel,
|
||||
char **arguments);
|
||||
extern struct t_hashtable *irc_message_parse_to_hashtable (const char *message);
|
||||
extern void irc_message_parse (struct t_irc_server *server, const char *message,
|
||||
char **nick, char **host, char **command,
|
||||
char **channel, char **arguments);
|
||||
extern struct t_hashtable *irc_message_parse_to_hashtable (struct t_irc_server *server,
|
||||
const char *message);
|
||||
extern const char *irc_message_get_nick_from_host (const char *host);
|
||||
extern const char *irc_message_get_address_from_host (const char *host);
|
||||
extern char *irc_message_replace_vars (struct t_irc_server *server,
|
||||
|
||||
@@ -605,8 +605,8 @@ irc_notify_hsignal_cb (void *data, const char *signal,
|
||||
}
|
||||
for (i = 0; i < num_messages; i++)
|
||||
{
|
||||
irc_message_parse (messages[i], NULL, NULL, NULL, NULL,
|
||||
&arguments);
|
||||
irc_message_parse (ptr_server, messages[i], NULL, NULL, NULL,
|
||||
NULL, &arguments);
|
||||
if (arguments)
|
||||
{
|
||||
pos = strchr (arguments, ' ');
|
||||
@@ -685,8 +685,8 @@ irc_notify_hsignal_cb (void *data, const char *signal,
|
||||
{
|
||||
for (i = 0; i < num_messages; i++)
|
||||
{
|
||||
irc_message_parse (messages[0], NULL, NULL, &irc_cmd, NULL,
|
||||
&arguments);
|
||||
irc_message_parse (ptr_server, messages[0], NULL, NULL,
|
||||
&irc_cmd, NULL, &arguments);
|
||||
if (irc_cmd && arguments)
|
||||
{
|
||||
if (strcmp (irc_cmd, "401") == 0)
|
||||
|
||||
@@ -742,7 +742,7 @@ IRC_PROTOCOL_CALLBACK(mode)
|
||||
|
||||
pos_modes = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3];
|
||||
|
||||
if (irc_channel_is_channel (argv[2]))
|
||||
if (irc_channel_is_channel (server, argv[2]))
|
||||
{
|
||||
ptr_channel = irc_channel_search (server, argv[2]);
|
||||
if (ptr_channel)
|
||||
@@ -954,7 +954,7 @@ IRC_PROTOCOL_CALLBACK(notice)
|
||||
if (argc < 4)
|
||||
return WEECHAT_RC_ERROR;
|
||||
pos_target = argv[2];
|
||||
is_channel = irc_channel_is_channel (pos_target + 1);
|
||||
is_channel = irc_channel_is_channel (server, pos_target + 1);
|
||||
if ((pos_target[0] == '@') && is_channel)
|
||||
{
|
||||
pos_target++;
|
||||
@@ -984,7 +984,7 @@ IRC_PROTOCOL_CALLBACK(notice)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pos_target && irc_channel_is_channel (pos_target))
|
||||
if (pos_target && irc_channel_is_channel (server, pos_target))
|
||||
{
|
||||
/* notice for channel */
|
||||
ptr_channel = irc_channel_search (server, pos_target);
|
||||
@@ -1375,7 +1375,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
|
||||
pos_args = (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3];
|
||||
|
||||
/* receiver is a channel ? */
|
||||
if (irc_channel_is_channel (argv[2]))
|
||||
if (irc_channel_is_channel (server, argv[2]))
|
||||
{
|
||||
ptr_channel = irc_channel_search (server, argv[2]);
|
||||
if (ptr_channel)
|
||||
@@ -1674,7 +1674,7 @@ IRC_PROTOCOL_CALLBACK(topic)
|
||||
|
||||
IRC_PROTOCOL_MIN_ARGS(3);
|
||||
|
||||
if (!irc_channel_is_channel (argv[2]))
|
||||
if (!irc_channel_is_channel (server, argv[2]))
|
||||
{
|
||||
weechat_printf (server->buffer,
|
||||
_("%s%s: \"%s\" command received without channel"),
|
||||
@@ -1974,6 +1974,21 @@ IRC_PROTOCOL_CALLBACK(005)
|
||||
pos2[0] = ' ';
|
||||
}
|
||||
|
||||
/* save chantypes */
|
||||
pos = strstr (argv_eol[3], "CHANTYPES=");
|
||||
if (pos)
|
||||
{
|
||||
pos += 10;
|
||||
pos2 = strchr (pos, ' ');
|
||||
if (pos2)
|
||||
pos2[0] = '\0';
|
||||
if (server->chantypes)
|
||||
free (server->chantypes);
|
||||
server->chantypes = strdup (pos);
|
||||
if (pos2)
|
||||
pos2[0] = ' ';
|
||||
}
|
||||
|
||||
/* save whole message (concatenate to existing isupport, if any) */
|
||||
pos_start = NULL;
|
||||
pos = strstr (argv_eol[3], " :");
|
||||
@@ -2813,7 +2828,7 @@ IRC_PROTOCOL_CALLBACK(330_343)
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_channel = (irc_channel_is_channel (argv[3])) ?
|
||||
ptr_channel = (irc_channel_is_channel (server, argv[3])) ?
|
||||
irc_channel_search (server, argv[3]) : NULL;
|
||||
ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
|
||||
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, argv[3],
|
||||
@@ -3528,7 +3543,7 @@ IRC_PROTOCOL_CALLBACK(353)
|
||||
|
||||
IRC_PROTOCOL_MIN_ARGS(5);
|
||||
|
||||
if (irc_channel_is_channel (argv[3]))
|
||||
if (irc_channel_is_channel (server, argv[3]))
|
||||
{
|
||||
pos_channel = argv[3];
|
||||
args = 4;
|
||||
|
||||
@@ -482,9 +482,9 @@ irc_server_get_isupport_value (struct t_irc_server *server, const char *feature)
|
||||
* irc_server_set_prefix_modes_chars: set "prefix_modes" and "prefix_chars" in
|
||||
* server using value of PREFIX in IRC
|
||||
* message 005
|
||||
* for example, if prefix is "(aohv)&@%+",
|
||||
* prefix_modes = "aohv"
|
||||
* prefix_chars = "&@%+"
|
||||
* for example, if prefix is "(ohv)@%+",
|
||||
* prefix_modes = "ohv"
|
||||
* prefix_chars = "@%+"
|
||||
*/
|
||||
|
||||
void
|
||||
@@ -719,6 +719,7 @@ irc_server_alloc (const char *name)
|
||||
new_server->prefix_chars = NULL;
|
||||
new_server->nick_max_length = 0;
|
||||
new_server->casemapping = IRC_SERVER_CASEMAPPING_RFC1459;
|
||||
new_server->chantypes = NULL;
|
||||
new_server->reconnect_delay = 0;
|
||||
new_server->reconnect_start = 0;
|
||||
new_server->command_time = 0;
|
||||
@@ -954,7 +955,7 @@ irc_server_alloc_with_url (const char *irc_url)
|
||||
/* autojoin */
|
||||
if (pos_channel && pos_channel[0])
|
||||
{
|
||||
if (irc_channel_is_channel (pos_channel))
|
||||
if (irc_channel_is_channel (ptr_server, pos_channel))
|
||||
server_autojoin = strdup (pos_channel);
|
||||
else
|
||||
{
|
||||
@@ -1652,7 +1653,7 @@ irc_server_send_one_msg (struct t_irc_server *server, int flags,
|
||||
|
||||
rc = 1;
|
||||
|
||||
irc_message_parse (message, &nick, NULL, &command, &channel, NULL);
|
||||
irc_message_parse (server, message, &nick, NULL, &command, &channel, NULL);
|
||||
snprintf (str_modifier, sizeof (str_modifier),
|
||||
"irc_out_%s",
|
||||
(command) ? command : "unknown");
|
||||
@@ -2076,7 +2077,9 @@ irc_server_msgq_flush ()
|
||||
irc_raw_print (irc_recv_msgq->server, IRC_RAW_FLAG_RECV,
|
||||
ptr_data);
|
||||
|
||||
irc_message_parse (ptr_data, NULL, NULL, &command, NULL, NULL);
|
||||
irc_message_parse (irc_recv_msgq->server,
|
||||
ptr_data, NULL, NULL, &command, NULL,
|
||||
NULL);
|
||||
snprintf (str_modifier, sizeof (str_modifier),
|
||||
"irc_in_%s",
|
||||
(command) ? command : "unknown");
|
||||
@@ -2112,11 +2115,14 @@ irc_server_msgq_flush ()
|
||||
ptr_msg);
|
||||
}
|
||||
|
||||
irc_message_parse (ptr_msg, &nick, &host, &command,
|
||||
irc_message_parse (irc_recv_msgq->server,
|
||||
ptr_msg, &nick, &host, &command,
|
||||
&channel, &arguments);
|
||||
|
||||
/* convert charset for message */
|
||||
if (channel && irc_channel_is_channel (channel))
|
||||
if (channel
|
||||
&& irc_channel_is_channel (irc_recv_msgq->server,
|
||||
channel))
|
||||
{
|
||||
snprintf (modifier_data, sizeof (modifier_data),
|
||||
"%s.%s.%s",
|
||||
@@ -4170,6 +4176,7 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name)
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, prefix_chars, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nick_max_length, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, casemapping, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, chantypes, STRING, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_delay, INTEGER, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, reconnect_start, TIME, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, command_time, TIME, NULL);
|
||||
@@ -4361,6 +4368,8 @@ irc_server_add_to_infolist (struct t_infolist *infolist,
|
||||
return 0;
|
||||
if (!weechat_infolist_new_var_string (ptr_item, "casemapping_string", irc_server_casemapping_string[server->casemapping]))
|
||||
return 0;
|
||||
if (!weechat_infolist_new_var_string (ptr_item, "chantypes", server->chantypes))
|
||||
return 0;
|
||||
if (!weechat_infolist_new_var_integer (ptr_item, "reconnect_delay", server->reconnect_delay))
|
||||
return 0;
|
||||
if (!weechat_infolist_new_var_time (ptr_item, "reconnect_start", server->reconnect_start))
|
||||
@@ -4666,6 +4675,7 @@ irc_server_print_log ()
|
||||
weechat_log_printf (" casemapping. . . . . : %d (%s)",
|
||||
ptr_server->casemapping,
|
||||
irc_server_casemapping_string[ptr_server->casemapping]);
|
||||
weechat_log_printf (" chantypes. . . . . . : '%s'", ptr_server->chantypes);
|
||||
weechat_log_printf (" reconnect_delay. . . : %d", ptr_server->reconnect_delay);
|
||||
weechat_log_printf (" reconnect_start. . . : %ld", ptr_server->reconnect_start);
|
||||
weechat_log_printf (" command_time . . . . : %ld", ptr_server->command_time);
|
||||
|
||||
@@ -163,10 +163,11 @@ struct t_irc_server
|
||||
char *nick; /* current nickname */
|
||||
char *nick_modes; /* nick modes */
|
||||
char *isupport; /* copy of message 005 (ISUPPORT) */
|
||||
char *prefix_modes; /* prefix modes from msg 005 (eg "aohv") */
|
||||
char *prefix_chars; /* prefix chars from msg 005 (eg "&@%+") */
|
||||
char *prefix_modes; /* prefix modes from msg 005 (eg "ohv") */
|
||||
char *prefix_chars; /* prefix chars from msg 005 (eg "@%+") */
|
||||
int nick_max_length; /* max lenth of nick (from msg 005) */
|
||||
int casemapping; /* casemapping from msg 005 */
|
||||
char *chantypes; /* chantypes from msg 005 (eg "&#") */
|
||||
int reconnect_delay; /* current reconnect delay (growing) */
|
||||
time_t reconnect_start; /* this time + delay = reconnect time */
|
||||
time_t command_time; /* this time + command_delay = time to */
|
||||
|
||||
@@ -374,6 +374,9 @@ irc_upgrade_read_cb (void *data,
|
||||
}
|
||||
irc_upgrade_current_server->nick_max_length = weechat_infolist_integer (infolist, "nick_max_length");
|
||||
irc_upgrade_current_server->casemapping = weechat_infolist_integer (infolist, "casemapping");
|
||||
str = weechat_infolist_string (infolist, "chantypes");
|
||||
if (str)
|
||||
irc_upgrade_current_server->chantypes = strdup (str);
|
||||
irc_upgrade_current_server->reconnect_delay = weechat_infolist_integer (infolist, "reconnect_delay");
|
||||
irc_upgrade_current_server->reconnect_start = weechat_infolist_time (infolist, "reconnect_start");
|
||||
irc_upgrade_current_server->command_time = weechat_infolist_time (infolist, "command_time");
|
||||
|
||||
Reference in New Issue
Block a user