--- a/libpurple/protocols/silc/chat.c Sat Feb 27 12:17:11 2021 -0600
+++ b/libpurple/protocols/silc/chat.c Sat Feb 27 18:01:09 2021 -0600
@@ -650,50 +650,31 @@
-silcpurple_chat_ulimit_cb(SilcPurpleChatInput s, const char *limit)
+silcpurple_chat_ulimit_cb(PurpleKeyValuePair *s, const char *limit) + SilcPurple sg = s->value; SilcChannelEntry channel;
- channel = silc_client_get_channel(s->sg->client, s->sg->conn,
+ channel = silc_client_get_channel(sg->client, sg->conn, s->key); ulimit = strtoul(limit, NULL, 10);
if (!limit || !(*limit) || *limit == '0') {
- if (limit && ulimit == channel->user_limit) {
+ if (!limit || ulimit != channel->user_limit) { + silc_client_command_call(sg->client, sg->conn, NULL, + "CMODE", s->key, "-l", NULL); - silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE",
- s->channel, "-l", NULL);
+ } else if (ulimit != channel->user_limit) { + silc_client_command_call(sg->client, sg->conn, NULL, + "CMODE", s->key, "+l", limit, NULL); - if (ulimit == channel->user_limit) {
- silc_client_command_call(s->sg->client, s->sg->conn, NULL, "CMODE",
- s->channel, "+l", limit, NULL);
+ purple_key_value_pair_free(s); @@ -703,7 +684,7 @@
SilcChannelEntry channel;
@@ -717,16 +698,12 @@
- ch = g_strdup(g_hash_table_lookup(purple_chat_get_components(chat), "channel"));
- channel = silc_client_get_channel(sg->client, sg->conn, (char *)ch);
+ ch = g_hash_table_lookup(purple_chat_get_components(chat), "channel"); + channel = silc_client_get_channel(sg->client, sg->conn, ch); - s = silc_calloc(1, sizeof(*s));
+ s = purple_key_value_pair_new(ch, sg); g_snprintf(tmp, sizeof(tmp), "%d", (int)channel->user_limit);
purple_request_input(gc, _("User Limit"), NULL,
_("Set user limit on channel. Set to zero to reset user limit."),