Handle empty messages on privmsg, notice, action

weechat-hashes
C. McEnroe 2020-02-05 22:15:08 -05:00
parent b2cf873304
commit 7cc64927bd
1 changed files with 3 additions and 1 deletions

View File

@ -27,6 +27,7 @@ static void commandQuote(size_t id, char *params) {
} }
static void commandPrivmsg(size_t id, char *params) { static void commandPrivmsg(size_t id, char *params) {
if (!params || !params[0]) return;
ircFormat("PRIVMSG %s :%s\r\n", idNames[id], params); ircFormat("PRIVMSG %s :%s\r\n", idNames[id], params);
struct Message msg = { struct Message msg = {
.nick = self.nick, .nick = self.nick,
@ -39,6 +40,7 @@ static void commandPrivmsg(size_t id, char *params) {
} }
static void commandNotice(size_t id, char *params) { static void commandNotice(size_t id, char *params) {
if (!params || !params[0]) return;
ircFormat("NOTICE %s :%s\r\n", idNames[id], params); ircFormat("NOTICE %s :%s\r\n", idNames[id], params);
struct Message msg = { struct Message msg = {
.nick = self.nick, .nick = self.nick,
@ -52,7 +54,7 @@ static void commandNotice(size_t id, char *params) {
static void commandMe(size_t id, char *params) { static void commandMe(size_t id, char *params) {
char buf[512]; char buf[512];
snprintf(buf, sizeof(buf), "\1ACTION %s\1", params); snprintf(buf, sizeof(buf), "\1ACTION %s\1", (params ? params : ""));
commandPrivmsg(id, buf); commandPrivmsg(id, buf);
} }