1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 19:05:41 +02:00

irc: add option irc.look.display_join_message (task #10895)

This commit is contained in:
Sebastien Helleu
2013-03-24 13:02:26 +01:00
parent e03310cb0d
commit a08603c24c
34 changed files with 541 additions and 207 deletions
+12 -4
View File
@@ -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);
+3 -1
View File
@@ -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 */
File diff suppressed because it is too large Load Diff
+2
View File
@@ -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;
File diff suppressed because it is too large Load Diff
+17 -2
View File
@@ -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)