236
236
struct t_gui_buffer *ptr_buffer, *ptr_buffer_for_merge;
237
237
int buffer_created, current_buffer_number, buffer_position;
238
238
int manual_join, noswitch;
239
char *buffer_name, str_number[32], *channel_name_lower;
240
const char *short_name, *localvar_channel;
239
char str_number[32], *channel_name_lower;
240
const char *buffer_name, *short_name, *localvar_channel;
242
242
buffer_created = 0;
351
351
weechat_buffer_set (ptr_buffer, "nicklist_display_groups", "0");
352
352
weechat_buffer_set_pointer (ptr_buffer, "nickcmp_callback",
353
353
&irc_buffer_nickcmp_cb);
354
weechat_buffer_set_pointer (ptr_buffer, "nickcmp_callback_data",
356
358
/* set highlights settings on channel buffer */
463
465
WEECHAT_HASHTABLE_STRING,
466
new_channel->checking_away = 0;
468
new_channel->checking_whox = 0;
467
469
new_channel->away_message = NULL;
468
470
new_channel->has_quit_server = 0;
469
471
new_channel->cycle = 0;
508
irc_channel_rename (struct t_irc_server *server,
509
struct t_irc_channel *channel,
510
const char *new_name)
512
struct t_irc_channel *ptr_channel;
514
const char *short_name;
516
/* check if another channel exists with this exact name */
517
for (ptr_channel = server->channels; ptr_channel;
518
ptr_channel = ptr_channel->next_channel)
520
if ((ptr_channel != channel)
521
&& (strcmp (ptr_channel->name, new_name) == 0))
527
/* rename the channel in buffer */
530
short_name = weechat_buffer_get_string (channel->buffer, "short_name");
531
if (!short_name || (strcmp (short_name, channel->name) == 0))
533
/* update the short_name only if it was not changed by the user */
534
weechat_buffer_set (channel->buffer, "short_name", new_name);
536
buffer_name = irc_buffer_build_name (server->name,
538
weechat_buffer_set (channel->buffer, "name", buffer_name);
539
weechat_buffer_set (channel->buffer, "localvar_set_channel", new_name);
542
/* rename the irc channel */
544
free (channel->name);
545
channel->name = strdup (new_name);
549
506
* Adds groups in nicklist for a channel.
639
* Removes account for all nicks on a channel.
643
irc_channel_remove_account (struct t_irc_server *server,
644
struct t_irc_channel *channel)
646
struct t_irc_nick *ptr_nick;
648
/* make C compiler happy */
651
if (channel->type == IRC_CHANNEL_TYPE_CHANNEL)
653
for (ptr_nick = channel->nicks; ptr_nick;
654
ptr_nick = ptr_nick->next_nick)
656
if (ptr_nick->account)
657
free (ptr_nick->account);
658
ptr_nick->account = strdup ("*");
682
664
* Removes away for all nicks on a channel.
691
673
if (channel->type == IRC_CHANNEL_TYPE_CHANNEL)
693
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
675
for (ptr_nick = channel->nicks; ptr_nick;
676
ptr_nick = ptr_nick->next_nick)
695
678
irc_nick_set_away (server, channel, ptr_nick, 0);
701
* Checks for away on a channel.
684
* Checks for WHOX information on a channel.
705
irc_channel_check_away (struct t_irc_server *server,
688
irc_channel_check_whox (struct t_irc_server *server,
706
689
struct t_irc_channel *channel)
708
691
if ((channel->type == IRC_CHANNEL_TYPE_CHANNEL) && channel->nicks)
710
693
if (server->cap_away_notify
694
|| server->cap_account_notify
711
695
|| ((IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK) > 0)
712
696
&& ((IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS) == 0)
713
697
|| (channel->nicks_count <= IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS)))))
715
channel->checking_away++;
716
irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_LOW, NULL,
717
"WHO %s", channel->name);
699
channel->checking_whox++;
700
if (irc_server_get_isupport_value (server, "WHOX"))
702
/* WHOX is supported */
703
irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_LOW, NULL,
704
"WHO %s %%cuhsnfdar", channel->name);
708
/* WHOX is NOT supported */
709
irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_LOW, NULL,
710
"WHO %s", channel->name);
720
irc_channel_remove_away (server, channel);
715
irc_channel_remove_account(server, channel);
716
irc_channel_remove_away(server, channel);
1456
1453
WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER, 0, NULL, NULL);
1457
1454
WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING, 0, NULL, NULL);
1458
1455
WEECHAT_HDATA_VAR(struct t_irc_channel, join_msg_received, HASHTABLE, 0, NULL, NULL);
1459
WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER, 0, NULL, NULL);
1456
WEECHAT_HDATA_VAR(struct t_irc_channel, checking_whox, INTEGER, 0, NULL, NULL);
1460
1457
WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING, 0, NULL, NULL);
1461
1458
WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER, 0, NULL, NULL);
1462
1459
WEECHAT_HDATA_VAR(struct t_irc_channel, cycle, INTEGER, 0, NULL, NULL);
1553
1550
if (!weechat_infolist_new_var_string (ptr_item, "join_msg_received",
1554
1551
weechat_hashtable_get_string (channel->join_msg_received, "keys")))
1556
if (!weechat_infolist_new_var_integer (ptr_item, "checking_away", channel->checking_away))
1553
if (!weechat_infolist_new_var_integer (ptr_item, "checking_whox", channel->checking_whox))
1558
1555
if (!weechat_infolist_new_var_string (ptr_item, "away_message", channel->away_message))
1637
1634
channel->join_msg_received,
1638
1635
weechat_hashtable_get_string (channel->join_msg_received,
1639
1636
"keys_values"));
1640
weechat_log_printf (" checking_away. . . . . . : %d", channel->checking_away);
1637
weechat_log_printf (" checking_whox. . . . . . : %d", channel->checking_whox);
1641
1638
weechat_log_printf (" away_message . . . . . . : '%s'", channel->away_message);
1642
1639
weechat_log_printf (" has_quit_server. . . . . : %d", channel->has_quit_server);
1643
1640
weechat_log_printf (" cycle. . . . . . . . . . : %d", channel->cycle);