1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 20:36:38 +02:00

relay: remove temporary option "nicklistdiff" (in command init), send nicklist diff by default (weechat protocol)

The temporary option was introduced because the nicklist diff was experimental.
It is now enabled by default, and there is no way to disable it. Therefore any
relay client using weechat protocol must implement the message "_nicklist_diff"
(unless nicklist is ignored by client).

Extra note: a full nicklist may still be sent if a message with diff would be
bigger than whole nicklist. So both full nicklist (message "_nicklist") and
nicklist diff (message "_nicklist_diff") must be implemented by clients.
This commit is contained in:
Sebastien Helleu
2013-05-01 21:01:12 +02:00
parent 305175fb8c
commit 86a8b9fb5f
3 changed files with 7 additions and 25 deletions
@@ -194,10 +194,6 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(init)
if (compression >= 0)
RELAY_WEECHAT_DATA(client, compression) = compression;
}
else if (strcmp (options[i], "nicklistdiff") == 0)
{
RELAY_WEECHAT_DATA(client, nicklist_diff) = 1;
}
}
}
weechat_string_free_split (options);
@@ -653,22 +649,14 @@ relay_weechat_protocol_nicklist_map_cb (void *data,
weechat_hdata_get_list (ptr_hdata, "gui_buffers"),
ptr_buffer))
{
if (RELAY_WEECHAT_DATA(ptr_client, nicklist_diff))
/*
* if no diff at all, or if diffs are bigger than nicklist:
* send whole nicklist
*/
if (ptr_nicklist
&& ((ptr_nicklist->items_count == 0)
|| (ptr_nicklist->items_count >= weechat_buffer_get_integer (ptr_buffer, "nicklist_count") + 1)))
{
/*
* if no diff at all, or if diffs are bigger than nicklist:
* send whole nicklist
*/
if (ptr_nicklist
&& ((ptr_nicklist->items_count == 0)
|| (ptr_nicklist->items_count >= weechat_buffer_get_integer (ptr_buffer, "nicklist_count") + 1)))
{
ptr_nicklist = NULL;
}
}
else
{
/* it will be removed soon (when clients will handle nicklist diff) */
ptr_nicklist = NULL;
}
@@ -176,7 +176,6 @@ relay_weechat_alloc (struct t_relay_client *client)
{
RELAY_WEECHAT_DATA(client, password_ok) = (password && password[0]) ? 0 : 1;
RELAY_WEECHAT_DATA(client, compression) = RELAY_WEECHAT_COMPRESSION_ZLIB;
RELAY_WEECHAT_DATA(client, nicklist_diff) = 0;
RELAY_WEECHAT_DATA(client, buffers_sync) =
weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
@@ -222,7 +221,6 @@ relay_weechat_alloc_with_infolist (struct t_relay_client *client,
/* general stuff */
RELAY_WEECHAT_DATA(client, password_ok) = weechat_infolist_integer (infolist, "password_ok");
RELAY_WEECHAT_DATA(client, compression) = weechat_infolist_integer (infolist, "compression");
RELAY_WEECHAT_DATA(client, nicklist_diff) = weechat_infolist_integer (infolist, "nicklist_diff");
/* sync of buffers */
RELAY_WEECHAT_DATA(client, buffers_sync) = weechat_hashtable_new (32,
@@ -307,8 +305,6 @@ relay_weechat_add_to_infolist (struct t_infolist_item *item,
return 0;
if (!weechat_infolist_new_var_integer (item, "compression", RELAY_WEECHAT_DATA(client, compression)))
return 0;
if (!weechat_infolist_new_var_integer (item, "nicklist_diff", RELAY_WEECHAT_DATA(client, nicklist_diff)))
return 0;
if (!weechat_hashtable_add_to_infolist (RELAY_WEECHAT_DATA(client, buffers_sync), item, "buffers_sync"))
return 0;
@@ -326,7 +322,6 @@ relay_weechat_print_log (struct t_relay_client *client)
{
weechat_log_printf (" password_ok. . . . . . : %d", RELAY_WEECHAT_DATA(client, password_ok));
weechat_log_printf (" compression. . . . . . : %d", RELAY_WEECHAT_DATA(client, compression));
weechat_log_printf (" nicklist_diff. . . . . : %d", RELAY_WEECHAT_DATA(client, nicklist_diff));
weechat_log_printf (" buffers_sync . . . . . : 0x%lx (hashtable: '%s')",
RELAY_WEECHAT_DATA(client, buffers_sync),
weechat_hashtable_get_string (RELAY_WEECHAT_DATA(client, buffers_sync),
@@ -37,7 +37,6 @@ struct t_relay_weechat_data
{
int password_ok; /* password received and OK? */
enum t_relay_weechat_compression compression; /* compression type */
int nicklist_diff; /* (TEMPORARY) nicklist diff enabled?*/
/* sync of buffers */
struct t_hashtable *buffers_sync; /* buffers synchronized (events */