From e97b1da0679594f6188e1b6f5633127364d3859a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5vard=20Pettersson?= Date: Wed, 19 Nov 2014 06:15:33 +0100 Subject: [PATCH] Added TWC_CHECK_GROUP_CHAT macro. --- src/twc-commands.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/twc-commands.c b/src/twc-commands.c index 7895244..e033b8e 100644 --- a/src/twc-commands.c +++ b/src/twc-commands.c @@ -73,6 +73,22 @@ enum TWC_FRIEND_MATCH return WEECHAT_RC_OK; \ } +/** + * Make sure a command is executed in a group chat buffer. If not, warn user + * and abort. + */ +#define TWC_CHECK_GROUP_CHAT(chat) \ + if (!chat || chat->group_number < 0) \ + { \ + weechat_printf(NULL, \ + "%s%s: command \"%s\" must be executed in a group " \ + "chat buffer ", \ + weechat_prefix("error"), \ + weechat_plugin->name, \ + argv[0]); \ + return WEECHAT_RC_OK; \ + } + /** * Make sure a profile with the given name exists. If not, warn user and * abort.