summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-03-24 13:02:26 +0100
committerSebastien Helleu <flashcode@flashtux.org>2013-03-24 13:02:26 +0100
commita08603c24c2a2b33fe8cdcb6e591ebf4cb7bd986 (patch)
tree344e827cf5bebbbad1dd6103b88df682ca69511b /src/plugins/irc
parente03310cb0d187bcf73485f25e9c40893238b17af (diff)
downloadweechat-a08603c24c2a2b33fe8cdcb6e591ebf4cb7bd986.zip
irc: add option irc.look.display_join_message (task #10895)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-channel.c16
-rw-r--r--src/plugins/irc/irc-channel.h4
-rw-r--r--src/plugins/irc/irc-config.c71
-rw-r--r--src/plugins/irc/irc-config.h2
-rw-r--r--src/plugins/irc/irc-protocol.c350
-rw-r--r--src/plugins/irc/irc-upgrade.c19
6 files changed, 289 insertions, 173 deletions
diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c
index 7d2f518f8..8c5276609 100644
--- a/src/plugins/irc/irc-channel.c
+++ b/src/plugins/irc/irc-channel.c
@@ -294,7 +294,11 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
{
new_channel->key = NULL;
}
- new_channel->names_received = 0;
+ new_channel->join_msg_received = weechat_hashtable_new (32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING,
+ NULL,
+ NULL);
new_channel->checking_away = 0;
new_channel->away_message = NULL;
new_channel->has_quit_server = 0;
@@ -1183,7 +1187,7 @@ irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
WEECHAT_HDATA_VAR(struct t_irc_channel, modes, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING, 0, NULL, NULL);
- WEECHAT_HDATA_VAR(struct t_irc_channel, names_received, INTEGER, 0, NULL, NULL);
+ WEECHAT_HDATA_VAR(struct t_irc_channel, join_msg_received, HASHTABLE, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER, 0, NULL, NULL);
@@ -1278,7 +1282,8 @@ irc_channel_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "key", channel->key))
return 0;
- if (!weechat_infolist_new_var_integer (ptr_item, "names_received", channel->names_received))
+ if (!weechat_infolist_new_var_string (ptr_item, "join_msg_received",
+ weechat_hashtable_get_string (channel->join_msg_received, "keys")))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "checking_away", channel->checking_away))
return 0;
@@ -1360,7 +1365,10 @@ irc_channel_print_log (struct t_irc_channel *channel)
weechat_log_printf (" modes. . . . . . . . . . : '%s'", channel->modes);
weechat_log_printf (" limit. . . . . . . . . . : %d", channel->limit);
weechat_log_printf (" key. . . . . . . . . . . : '%s'", channel->key);
- weechat_log_printf (" names_received . . . . . : %d", channel->names_received);
+ weechat_log_printf (" join_msg_received. . . . : 0x%lx (hashtable: '%s')",
+ channel->join_msg_received,
+ weechat_hashtable_get_string (channel->join_msg_received,
+ "keys_values"));
weechat_log_printf (" checking_away. . . . . . : %d", channel->checking_away);
weechat_log_printf (" away_message . . . . . . : '%s'", channel->away_message);
weechat_log_printf (" has_quit_server. . . . . : %d", channel->has_quit_server);
diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h
index 3a8d39096..1e76b06fb 100644
--- a/src/plugins/irc/irc-channel.h
+++ b/src/plugins/irc/irc-channel.h
@@ -47,7 +47,9 @@ struct t_irc_channel
char *modes; /* channel modes */
int limit; /* user limit (0 is limit not set) */
char *key; /* channel key (NULL if no key set) */
- int names_received; /* names received (message 366) */
+ struct t_hashtable *join_msg_received; /* messages received after join: */
+ /* 366=names, 332/333=topic, */
+ /* 329=creation date */
int checking_away; /* = 1 if checking away with WHO cmd */
char *away_message; /* to display away only once in pv */
int has_quit_server; /* =1 if nick has quit (pv only), to */
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index cdadf97cd..8075903c4 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -73,6 +73,7 @@ struct t_config_option *irc_config_look_display_ctcp_unknown;
struct t_config_option *irc_config_look_display_host_join;
struct t_config_option *irc_config_look_display_host_join_local;
struct t_config_option *irc_config_look_display_host_quit;
+struct t_config_option *irc_config_look_display_join_message;
struct t_config_option *irc_config_look_display_old_topic;
struct t_config_option *irc_config_look_display_pv_away_once;
struct t_config_option *irc_config_look_display_pv_back;
@@ -141,6 +142,7 @@ struct t_config_option *irc_config_server_default[IRC_SERVER_NUM_OPTIONS];
struct t_hook *irc_config_hook_config_nick_colors = NULL;
char **irc_config_nick_colors = NULL;
int irc_config_num_nick_colors = 0;
+struct t_hashtable *irc_config_hashtable_display_join_message = NULL;
struct t_hashtable *irc_config_hashtable_nick_color_force = NULL;
struct t_hashtable *irc_config_hashtable_nick_prefixes = NULL;
struct t_hashtable *irc_config_hashtable_color_mirc_remap = NULL;
@@ -275,6 +277,45 @@ irc_config_change_look_color_nicks_in_nicklist (void *data,
}
/*
+ * Callback for changes on option "irc.look.display_join_message".
+ */
+
+void
+irc_config_change_look_display_join_message (void *data,
+ struct t_config_option *option)
+{
+ char **items;
+ int num_items, i;
+
+ /* make C compiler happy */
+ (void) data;
+ (void) option;
+
+ if (!irc_config_hashtable_display_join_message)
+ {
+ irc_config_hashtable_display_join_message = weechat_hashtable_new (32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING,
+ NULL,
+ NULL);
+ }
+ else
+ weechat_hashtable_remove_all (irc_config_hashtable_display_join_message);
+
+ items = weechat_string_split (weechat_config_string (irc_config_look_display_join_message),
+ ",", 0, 0, &num_items);
+ if (items)
+ {
+ for (i = 0; i < num_items; i++)
+ {
+ weechat_hashtable_set (irc_config_hashtable_display_join_message,
+ items[i], "1");
+ }
+ weechat_string_free_split (items);
+ }
+}
+
+/*
* Callback for changes on option "irc.look.server_buffer".
*/
@@ -2052,11 +2093,11 @@ irc_config_init ()
{
struct t_config_section *ptr_section;
- irc_config_hashtable_color_mirc_remap = weechat_hashtable_new (32,
- WEECHAT_HASHTABLE_STRING,
- WEECHAT_HASHTABLE_STRING,
- NULL,
- NULL);
+ irc_config_hashtable_display_join_message = weechat_hashtable_new (32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING,
+ NULL,
+ NULL);
irc_config_hashtable_nick_color_force = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@@ -2067,6 +2108,11 @@ irc_config_init ()
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
+ irc_config_hashtable_color_mirc_remap = weechat_hashtable_new (32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING,
+ NULL,
+ NULL);
irc_config_file = weechat_config_new (IRC_CONFIG_NAME,
&irc_config_reload, NULL);
@@ -2257,6 +2303,14 @@ irc_config_init ()
N_("display host in part/quit messages"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
+ irc_config_look_display_join_message = weechat_config_new_option (
+ irc_config_file, ptr_section,
+ "display_join_message", "string",
+ N_("comma-separated list of messages to display after joining a channel: "
+ "329 = channel creation date, 332 = topic, 333 = nick/date for topic, "
+ "366 = names on channel"),
+ NULL, 0, 0, "329,332,333,366", NULL, 0, NULL, NULL,
+ &irc_config_change_look_display_join_message, NULL, NULL, NULL);
irc_config_look_display_old_topic = weechat_config_new_option (
irc_config_file, ptr_section,
"display_old_topic", "boolean",
@@ -2754,6 +2808,7 @@ irc_config_read ()
if (rc == WEECHAT_CONFIG_READ_OK)
{
irc_notify_new_for_all_servers ();
+ irc_config_change_look_display_join_message (NULL, NULL);
irc_config_change_look_nick_color_force (NULL, NULL);
irc_config_change_look_nicks_hide_password (NULL, NULL);
irc_config_change_color_nick_prefixes (NULL, NULL);
@@ -2804,6 +2859,12 @@ irc_config_free ()
irc_config_num_nicks_hide_password = 0;
}
+ if (irc_config_hashtable_display_join_message)
+ {
+ weechat_hashtable_free (irc_config_hashtable_display_join_message);
+ irc_config_hashtable_display_join_message = NULL;
+ }
+
if (irc_config_hashtable_nick_color_force)
{
weechat_hashtable_free (irc_config_hashtable_nick_color_force);
diff --git a/src/plugins/irc/irc-config.h b/src/plugins/irc/irc-config.h
index 9b28e2ed0..6a9c3f21d 100644
--- a/src/plugins/irc/irc-config.h
+++ b/src/plugins/irc/irc-config.h
@@ -115,6 +115,7 @@ extern struct t_config_option *irc_config_look_display_ctcp_unknown;
extern struct t_config_option *irc_config_look_display_host_join;
extern struct t_config_option *irc_config_look_display_host_join_local;
extern struct t_config_option *irc_config_look_display_host_quit;
+extern struct t_config_option *irc_config_look_display_join_message;
extern struct t_config_option *irc_config_look_display_old_topic;
extern struct t_config_option *irc_config_look_display_pv_away_once;
extern struct t_config_option *irc_config_look_display_pv_back;
@@ -177,6 +178,7 @@ extern struct t_config_option *irc_config_server_default[];
extern char **irc_config_nick_colors;
extern int irc_config_num_nick_colors;
+extern struct t_hashtable *irc_config_hashtable_display_join_message;
extern struct t_hashtable *irc_config_hashtable_nick_color_force;
extern struct t_hashtable *irc_config_hashtable_nick_prefixes;
extern struct t_hashtable *irc_config_hashtable_color_mirc_remap;
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 2b2d11dd2..de26867ad 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -561,7 +561,7 @@ IRC_PROTOCOL_CALLBACK(join)
ptr_channel->modes = NULL;
}
ptr_channel->limit = 0;
- ptr_channel->names_received = 0;
+ weechat_hashtable_remove_all (ptr_channel->join_msg_received);
ptr_channel->checking_away = 0;
}
@@ -2967,15 +2967,19 @@ IRC_PROTOCOL_CALLBACK(329)
if (ptr_channel)
{
- weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
- command, NULL,
- ptr_channel->buffer),
- date,
- irc_protocol_tags (command, "irc_numeric", NULL),
- /* TRANSLATORS: "%s" after "created on" is a date */
- _("%sChannel created on %s"),
- weechat_prefix ("network"),
- weechat_util_get_time_string (&datetime));
+ if (weechat_hashtable_has_key (ptr_channel->join_msg_received, command)
+ || weechat_hashtable_has_key (irc_config_hashtable_display_join_message, command))
+ {
+ weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
+ command, NULL,
+ ptr_channel->buffer),
+ date,
+ irc_protocol_tags (command, "irc_numeric", NULL),
+ /* TRANSLATORS: "%s" after "created on" is a date */
+ _("%sChannel created on %s"),
+ weechat_prefix ("network"),
+ weechat_util_get_time_string (&datetime));
+ }
}
else
{
@@ -2993,6 +2997,9 @@ IRC_PROTOCOL_CALLBACK(329)
weechat_util_get_time_string (&datetime));
}
+ if (ptr_channel)
+ weechat_hashtable_set (ptr_channel->join_msg_received, command, "1");
+
return WEECHAT_RC_OK;
}
@@ -3129,21 +3136,31 @@ IRC_PROTOCOL_CALLBACK(332)
topic_color = irc_color_decode (pos_topic,
(weechat_config_boolean (irc_config_network_colors_receive)) ? 1 : 0);
}
- weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
- command, NULL,
- ptr_buffer),
- date,
- irc_protocol_tags (command, "irc_numeric", NULL),
- _("%sTopic for %s%s%s is \"%s%s\""),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- argv[3],
- IRC_COLOR_RESET,
- (topic_color) ? topic_color : ((pos_topic) ? pos_topic : ""),
- IRC_COLOR_RESET);
+
+ if (!ptr_channel
+ || (weechat_hashtable_has_key (ptr_channel->join_msg_received, command))
+ || weechat_hashtable_has_key (irc_config_hashtable_display_join_message, command))
+ {
+ weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
+ command, NULL,
+ ptr_buffer),
+ date,
+ irc_protocol_tags (command, "irc_numeric", NULL),
+ _("%sTopic for %s%s%s is \"%s%s\""),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ argv[3],
+ IRC_COLOR_RESET,
+ (topic_color) ? topic_color : ((pos_topic) ? pos_topic : ""),
+ IRC_COLOR_RESET);
+ }
+
if (topic_color)
free (topic_color);
+ if (ptr_channel)
+ weechat_hashtable_set (ptr_channel->join_msg_received, command, "1");
+
return WEECHAT_RC_OK;
}
@@ -3182,38 +3199,42 @@ IRC_PROTOCOL_CALLBACK(333)
if (ptr_channel && ptr_channel->nicks)
{
- if (topic_nick)
- {
- weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
- command, NULL,
- ptr_channel->buffer),
- date,
- irc_protocol_tags (command, "irc_numeric", NULL),
- /* TRANSLATORS: "%s" after "on" is a date */
- _("%sTopic set by %s%s%s%s%s%s%s%s%s on %s"),
- weechat_prefix ("network"),
- irc_nick_color_for_server_message (server, ptr_nick, topic_nick),
- topic_nick,
- IRC_COLOR_CHAT_DELIMITERS,
- (topic_address && topic_address[0]) ? " (" : "",
- IRC_COLOR_CHAT_HOST,
- (topic_address) ? topic_address : "",
- IRC_COLOR_CHAT_DELIMITERS,
- (topic_address && topic_address[0]) ? ")" : "",
- IRC_COLOR_RESET,
- weechat_util_get_time_string (&datetime));
- }
- else
+ if (weechat_hashtable_has_key (ptr_channel->join_msg_received, command)
+ || weechat_hashtable_has_key (irc_config_hashtable_display_join_message, command))
{
- weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
- command, NULL,
- ptr_channel->buffer),
- date,
- irc_protocol_tags (command, "irc_numeric", NULL),
- /* TRANSLATORS: "%s" after "on" is a date */
- _("%sTopic set on %s"),
- weechat_prefix ("network"),
- weechat_util_get_time_string (&datetime));
+ if (topic_nick)
+ {
+ weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
+ command, NULL,
+ ptr_channel->buffer),
+ date,
+ irc_protocol_tags (command, "irc_numeric", NULL),
+ /* TRANSLATORS: "%s" after "on" is a date */
+ _("%sTopic set by %s%s%s%s%s%s%s%s%s on %s"),
+ weechat_prefix ("network"),
+ irc_nick_color_for_server_message (server, ptr_nick, topic_nick),
+ topic_nick,
+ IRC_COLOR_CHAT_DELIMITERS,
+ (topic_address && topic_address[0]) ? " (" : "",
+ IRC_COLOR_CHAT_HOST,
+ (topic_address) ? topic_address : "",
+ IRC_COLOR_CHAT_DELIMITERS,
+ (topic_address && topic_address[0]) ? ")" : "",
+ IRC_COLOR_RESET,
+ weechat_util_get_time_string (&datetime));
+ }
+ else
+ {
+ weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
+ command, NULL,
+ ptr_channel->buffer),
+ date,
+ irc_protocol_tags (command, "irc_numeric", NULL),
+ /* TRANSLATORS: "%s" after "on" is a date */
+ _("%sTopic set on %s"),
+ weechat_prefix ("network"),
+ weechat_util_get_time_string (&datetime));
+ }
}
}
else
@@ -3259,6 +3280,9 @@ IRC_PROTOCOL_CALLBACK(333)
}
}
+ if (ptr_channel)
+ weechat_hashtable_set (ptr_channel->join_msg_received, command, "1");
+
return WEECHAT_RC_OK;
}
@@ -3930,133 +3954,137 @@ IRC_PROTOCOL_CALLBACK(366)
ptr_channel = irc_channel_search (server, argv[3]);
if (ptr_channel && ptr_channel->nicks)
{
- /* display users on channel */
- infolist = weechat_infolist_get ("nicklist", ptr_channel->buffer, NULL);
- if (infolist)
+ if (weechat_hashtable_has_key (ptr_channel->join_msg_received, command)
+ || weechat_hashtable_has_key (irc_config_hashtable_display_join_message, command))
{
- length = 0;
- while (weechat_infolist_next (infolist))
+ /* display users on channel */
+ infolist = weechat_infolist_get ("nicklist", ptr_channel->buffer, NULL);
+ if (infolist)
{
- if (strcmp (weechat_infolist_string (infolist, "type"),
- "nick") == 0)
+ length = 0;
+ while (weechat_infolist_next (infolist))
{
- ptr_option = weechat_config_get (weechat_infolist_string (infolist,
- "prefix_color"));
- length +=
- ((ptr_option) ? strlen (weechat_color (weechat_config_string (ptr_option))) : 0) +
- strlen (weechat_infolist_string (infolist, "prefix")) +
- 16 + /* nick color */
- strlen (weechat_infolist_string (infolist, "name")) +
- 16 + /* reset color */
- 1; /* space */
+ if (strcmp (weechat_infolist_string (infolist, "type"),
+ "nick") == 0)
+ {
+ ptr_option = weechat_config_get (weechat_infolist_string (infolist,
+ "prefix_color"));
+ length +=
+ ((ptr_option) ? strlen (weechat_color (weechat_config_string (ptr_option))) : 0) +
+ strlen (weechat_infolist_string (infolist, "prefix")) +
+ 16 + /* nick color */
+ strlen (weechat_infolist_string (infolist, "name")) +
+ 16 + /* reset color */
+ 1; /* space */
+ }
}
- }
- if (length > 0)
- {
- string = malloc (length);
- if (string)
+ if (length > 0)
{
- string[0] = '\0';
- i = 0;
- while (weechat_infolist_next (infolist))
+ string = malloc (length);
+ if (string)
{
- if (strcmp (weechat_infolist_string (infolist, "type"),
- "nick") == 0)
+ string[0] = '\0';
+ i = 0;
+ while (weechat_infolist_next (infolist))
{
- if (i > 0)
+ if (strcmp (weechat_infolist_string (infolist, "type"),
+ "nick") == 0)
{
- strcat (string, IRC_COLOR_RESET);
- strcat (string, " ");
- }
- prefix = weechat_infolist_string (infolist, "prefix");
- if (prefix[0] && (prefix[0] != ' '))
- {
- prefix_color = weechat_infolist_string (infolist,
- "prefix_color");
- if (strchr (prefix_color, '.'))
+ if (i > 0)
{
- ptr_option = weechat_config_get (weechat_infolist_string (infolist,
- "prefix_color"));
- if (ptr_option)
- strcat (string, weechat_color (weechat_config_string (ptr_option)));
+ strcat (string, IRC_COLOR_RESET);
+ strcat (string, " ");
}
- else
+ prefix = weechat_infolist_string (infolist, "prefix");
+ if (prefix[0] && (prefix[0] != ' '))
{
- strcat (string, weechat_color (prefix_color));
+ prefix_color = weechat_infolist_string (infolist,
+ "prefix_color");
+ if (strchr (prefix_color, '.'))
+ {
+ ptr_option = weechat_config_get (weechat_infolist_string (infolist,
+ "prefix_color"));
+ if (ptr_option)
+ strcat (string, weechat_color (weechat_config_string (ptr_option)));
+ }
+ else
+ {
+ strcat (string, weechat_color (prefix_color));
+ }
+ strcat (string, prefix);
+ }
+ nickname = weechat_infolist_string (infolist, "name");
+ if (weechat_config_boolean (irc_config_look_color_nicks_in_names))
+ {
+ if (irc_server_strcasecmp (server, nickname, server->nick) == 0)
+ strcat (string, IRC_COLOR_CHAT_NICK_SELF);
+ else
+ strcat (string, irc_nick_find_color (nickname));
}
- strcat (string, prefix);
- }
- nickname = weechat_infolist_string (infolist, "name");
- if (weechat_config_boolean (irc_config_look_color_nicks_in_names))
- {
- if (irc_server_strcasecmp (server, nickname, server->nick) == 0)
- strcat (string, IRC_COLOR_CHAT_NICK_SELF);
else
- strcat (string, irc_nick_find_color (nickname));
+ strcat (string, IRC_COLOR_RESET);
+ strcat (string, nickname);
+ i++;
}
- else
- strcat (string, IRC_COLOR_RESET);
- strcat (string, nickname);
- i++;
}
+ weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
+ command, "names",
+ ptr_channel->buffer),
+ date,
+ irc_protocol_tags (command, "irc_numeric", NULL),
+ _("%sNicks %s%s%s: %s[%s%s]"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ ptr_channel->name,
+ IRC_COLOR_RESET,
+ IRC_COLOR_CHAT_DELIMITERS,
+ string,
+ IRC_COLOR_CHAT_DELIMITERS);
+ free (string);
}
- weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
- command, "names",
- ptr_channel->buffer),
- date,
- irc_protocol_tags (command, "irc_numeric", NULL),
- _("%sNicks %s%s%s: %s[%s%s]"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- ptr_channel->name,
- IRC_COLOR_RESET,
- IRC_COLOR_CHAT_DELIMITERS,
- string,
- IRC_COLOR_CHAT_DELIMITERS);
- free (string);
}
+ weechat_infolist_free (infolist);
}
- weechat_infolist_free (infolist);
- }
- /* display number of nicks, ops, halfops & voices on the channel */
- irc_nick_count (server, ptr_channel, &num_nicks, &num_op, &num_halfop,
- &num_voice, &num_normal);
- weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
- command, "names",
- ptr_channel->buffer),
- date,
- irc_protocol_tags (command, "irc_numeric", NULL),
- _("%sChannel %s%s%s: %s%d%s %s %s(%s%d%s %s, "
- "%s%d%s %s, %s%d%s %s, %s%d%s %s%s)"),
- weechat_prefix ("network"),
- IRC_COLOR_CHAT_CHANNEL,
- ptr_channel->name,
- IRC_COLOR_RESET,
- IRC_COLOR_CHAT_CHANNEL,
- num_nicks,
- IRC_COLOR_RESET,
- NG_("nick", "nicks", num_nicks),
- IRC_COLOR_CHAT_DELIMITERS,
- IRC_COLOR_CHAT_CHANNEL,
- num_op,
- IRC_COLOR_RESET,
- NG_("op", "ops", num_op),
- IRC_COLOR_CHAT_CHANNEL,
- num_halfop,
- IRC_COLOR_RESET,
- NG_("halfop", "halfops", num_halfop),
- IRC_COLOR_CHAT_CHANNEL,
- num_voice,
- IRC_COLOR_RESET,
- NG_("voice", "voices", num_voice),
- IRC_COLOR_CHAT_CHANNEL,
- num_normal,
- IRC_COLOR_RESET,
- NG_("normal", "normals", num_normal),
- IRC_COLOR_CHAT_DELIMITERS);
+ /* display number of nicks, ops, halfops & voices on the channel */
+ irc_nick_count (server, ptr_channel, &num_nicks, &num_op, &num_halfop,
+ &num_voice, &num_normal);
+ weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, NULL,
+ command, "names",
+ ptr_channel->buffer),
+ date,
+ irc_protocol_tags (command, "irc_numeric", NULL),
+ _("%sChannel %s%s%s: %s%d%s %s %s(%s%d%s %s, "
+ "%s%d%s %s, %s%d%s %s, %s%d%s %s%s)"),
+ weechat_prefix ("network"),
+ IRC_COLOR_CHAT_CHANNEL,
+ ptr_channel->name,
+ IRC_COLOR_RESET,
+ IRC_COLOR_CHAT_CHANNEL,
+ num_nicks,
+ IRC_COLOR_RESET,
+ NG_("nick", "nicks", num_nicks),
+ IRC_COLOR_CHAT_DELIMITERS,
+ IRC_COLOR_CHAT_CHANNEL,
+ num_op,
+ IRC_COLOR_RESET,
+ NG_("op", "ops", num_op),
+ IRC_COLOR_CHAT_CHANNEL,
+ num_halfop,
+ IRC_COLOR_RESET,
+ NG_("halfop", "halfops", num_halfop),
+ IRC_COLOR_CHAT_CHANNEL,
+ num_voice,
+ IRC_COLOR_RESET,
+ NG_("voice", "voices", num_voice),
+ IRC_COLOR_CHAT_CHANNEL,
+ num_normal,
+ IRC_COLOR_RESET,
+ NG_("normal", "normals", num_normal),
+ IRC_COLOR_CHAT_DELIMITERS);
+ }
- if (!ptr_channel->names_received)
+ if (!weechat_hashtable_has_key (ptr_channel->join_msg_received, command))
{
irc_command_mode_server (server, ptr_channel, NULL,
IRC_SERVER_SEND_OUTQ_PRIO_LOW);
@@ -4079,7 +4107,7 @@ IRC_PROTOCOL_CALLBACK(366)
}
if (ptr_channel)
- ptr_channel->names_received = 1;
+ weechat_hashtable_set (ptr_channel->join_msg_received, command, "1");
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index 3a9568a06..27f6c54b7 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -284,10 +284,11 @@ irc_upgrade_read_cb (void *data,
int object_id,
struct t_infolist *infolist)
{
- int flags, sock, size, i, index, nicks_count;
+ int flags, sock, size, i, index, nicks_count, num_items;
long number;
time_t join_time;
char *buf, option_name[64], **nicks, *nick_join, *pos, *error;
+ char **items;
const char *buffer_name, *str, *nick;
struct t_irc_nick *ptr_nick;
struct t_irc_redirect *ptr_redirect;
@@ -442,7 +443,21 @@ irc_upgrade_read_cb (void *data,
str = weechat_infolist_string (infolist, "key");
if (str)
irc_upgrade_current_channel->key = strdup (str);
- irc_upgrade_current_channel->names_received = weechat_infolist_integer (infolist, "names_received");
+ str = weechat_infolist_string (infolist, "join_msg_received");
+ if (str)
+ {
+ items = weechat_string_split (str, ",", 0, 0,
+ &num_items);
+ if (items)
+ {
+ for (i = 0; i < num_items; i++)
+ {
+ weechat_hashtable_set (irc_upgrade_current_channel->join_msg_received,
+ items[i], "1");
+ }
+ weechat_string_free_split (items);
+ }
+ }
irc_upgrade_current_channel->checking_away = weechat_infolist_integer (infolist, "checking_away");
str = weechat_infolist_string (infolist, "away_message");
if (str)