summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-command.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-05-20 15:21:07 +0200
committerSébastien Helleu <flashcode@flashtux.org>2018-05-20 15:21:07 +0200
commitafb1d0305313edef297e2f1f6ced9058a4560556 (patch)
tree789625c55c21c377a2618c709bfef2b56ad90693 /src/plugins/irc/irc-command.c
parent0329a9c7cde1334d0de17440b6d2d304bdf2e6eb (diff)
parent0a348f0b9dd31fe8546e61d445f23b44a26d1abf (diff)
downloadweechat-afb1d0305313edef297e2f1f6ced9058a4560556.zip
Merge remote-tracking branch 'origin/pr/623' into irc-3.2-cap
Diffstat (limited to 'src/plugins/irc/irc-command.c')
-rw-r--r--src/plugins/irc/irc-command.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index f4703866a..22a1977e2 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -1223,6 +1223,8 @@ IRC_COMMAND_CALLBACK(ban)
IRC_COMMAND_CALLBACK(cap)
{
+ char *cap_cmd;
+
IRC_BUFFER_GET_SERVER(buffer);
IRC_COMMAND_CHECK_SERVER("cap", 1);
@@ -1232,11 +1234,27 @@ IRC_COMMAND_CALLBACK(cap)
if (argc > 1)
{
- irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
- "CAP %s%s%s",
- argv[1],
- (argv_eol[2]) ? " :" : "",
- (argv_eol[2]) ? argv_eol[2] : "");
+ cap_cmd = strdup (argv[1]);
+ if (!cap_cmd)
+ WEECHAT_COMMAND_ERROR;
+
+ weechat_string_toupper (cap_cmd);
+
+ if ((weechat_strcasecmp (argv[1], "ls") == 0) && !argv_eol[2])
+ {
+ irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
+ "CAP LS " IRC_SERVER_VERSION_CAP);
+ }
+ else
+ {
+ irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
+ "CAP %s%s%s",
+ cap_cmd,
+ (argv_eol[2]) ? " :" : "",
+ (argv_eol[2]) ? argv_eol[2] : "");
+ }
+
+ free (cap_cmd);
}
else
{
@@ -1245,7 +1263,7 @@ IRC_COMMAND_CALLBACK(cap)
* enabled
*/
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
- "CAP LS");
+ "CAP LS " IRC_SERVER_VERSION_CAP);
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"CAP LIST");
}