diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2012-05-17 09:37:04 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2012-05-17 09:37:04 +0200 |
commit | 04275a735496846c5dba900db6e6310b454e35b3 (patch) | |
tree | f55426ff8628080ba1a12ac14652837ee21a0ff7 /src/plugins/relay | |
parent | 68025527874d2d98d4d9f85ddea84db577307743 (diff) | |
download | weechat-04275a735496846c5dba900db6e6310b454e35b3.zip |
relay: fix crash on /upgrade when client is connected using WeeChat protocol
Diffstat (limited to 'src/plugins/relay')
-rw-r--r-- | src/plugins/relay/weechat/relay-weechat.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/plugins/relay/weechat/relay-weechat.c b/src/plugins/relay/weechat/relay-weechat.c index f7ca452e2..02f1e6605 100644 --- a/src/plugins/relay/weechat/relay-weechat.c +++ b/src/plugins/relay/weechat/relay-weechat.c @@ -225,9 +225,9 @@ relay_weechat_alloc_with_infolist (struct t_relay_client *client, struct t_infolist *infolist) { struct t_relay_weechat_data *weechat_data; - int index, rc, value_int; + int index, value; char name[64]; - const char *key, *value; + const char *key, *str_value; client->protocol_data = malloc (sizeof (*weechat_data)); if (client->protocol_data) @@ -239,7 +239,7 @@ relay_weechat_alloc_with_infolist (struct t_relay_client *client, /* sync of buffers */ RELAY_WEECHAT_DATA(client, buffers_sync) = weechat_hashtable_new (16, WEECHAT_HASHTABLE_STRING, - WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_INTEGER, NULL, NULL); index = 0; @@ -250,13 +250,10 @@ relay_weechat_alloc_with_infolist (struct t_relay_client *client, if (!key) break; snprintf (name, sizeof (name), "buffers_sync_value_%05d", index); - value = weechat_infolist_string (infolist, name); - rc = sscanf (value, "%d", &value_int); - if ((rc == EOF) || (rc == 0)) - value_int = 0; + value = weechat_infolist_integer (infolist, name); weechat_hashtable_set (RELAY_WEECHAT_DATA(client, buffers_sync), key, - &value_int); + &value); index++; } RELAY_WEECHAT_DATA(client, hook_signal_buffer) = NULL; @@ -275,10 +272,10 @@ relay_weechat_alloc_with_infolist (struct t_relay_client *client, if (!key) break; snprintf (name, sizeof (name), "buffers_nicklist_value_%05d", index); - value = weechat_infolist_string (infolist, name); - weechat_hashtable_set (RELAY_WEECHAT_DATA(client, buffers_sync), + str_value = weechat_infolist_string (infolist, name); + weechat_hashtable_set (RELAY_WEECHAT_DATA(client, buffers_nicklist), key, - value); + str_value); index++; } RELAY_WEECHAT_DATA(client, hook_timer_nicklist) = NULL; |