Skip STATUSMSG prefixes

This feature is rarely used, so just skip STATUSMSG prefixes in the
target so messages get routed correctly.
weechat-hashes
C. McEnroe 2021-04-02 17:03:10 -04:00
parent 86a0594cd2
commit df6bc07f44
2 changed files with 7 additions and 0 deletions

1
chat.h
View File

@ -155,6 +155,7 @@ extern struct Network {
uint userLen; uint userLen;
uint hostLen; uint hostLen;
char *chanTypes; char *chanTypes;
char *statusmsg;
char *prefixes; char *prefixes;
char *prefixModes; char *prefixModes;
char *listModes; char *listModes;

View File

@ -270,6 +270,9 @@ static void handleReplyISupport(struct Message *msg) {
} else if (!strcmp(key, "CHANTYPES")) { } else if (!strcmp(key, "CHANTYPES")) {
if (!msg->params[i]) continue; if (!msg->params[i]) continue;
set(&network.chanTypes, msg->params[i]); set(&network.chanTypes, msg->params[i]);
} else if (!strcmp(key, "STATUSMSG")) {
if (!msg->params[i]) continue;
set(&network.statusmsg, msg->params[i]);
} else if (!strcmp(key, "PREFIX")) { } else if (!strcmp(key, "PREFIX")) {
strsep(&msg->params[i], "("); strsep(&msg->params[i], "(");
char *modes = strsep(&msg->params[i], ")"); char *modes = strsep(&msg->params[i], ")");
@ -1196,6 +1199,9 @@ static void colorMentions(struct Cat *cat, uint id, struct Message *msg) {
static void handlePrivmsg(struct Message *msg) { static void handlePrivmsg(struct Message *msg) {
require(msg, true, 2); require(msg, true, 2);
if (network.statusmsg) {
msg->params[0] += strspn(msg->params[0], network.statusmsg);
}
bool query = !strchr(network.chanTypes, msg->params[0][0]); bool query = !strchr(network.chanTypes, msg->params[0][0]);
bool server = strchr(msg->nick, '.'); bool server = strchr(msg->nick, '.');
bool mine = !strcmp(msg->nick, self.nick); bool mine = !strcmp(msg->nick, self.nick);