Skip to content

Commit

Permalink
Check account info for msg/notice binds
Browse files Browse the repository at this point in the history
  • Loading branch information
vanosg committed Jun 15, 2024
1 parent 25ed117 commit f6e48c6
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions src/mod/server.mod/servmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,9 @@ static int gotmsg(char *from, char *msg)
char *to, buf[UHOSTLEN], *nick, ctcpbuf[512], *uhost = buf, *ctcp,
*p, *p1, *code;
struct userrec *u;
int ctcp_count = 0;
memberlist *m = NULL;
struct chanset_t *chan;
int found = 0, ctcp_count = 0;
int ignoring;

/* Notice to a channel, not handled here */
Expand Down Expand Up @@ -670,7 +672,19 @@ static int gotmsg(char *from, char *msg)
}

detect_flood(nick, uhost, from, FLOOD_PRIVMSG);
u = lookup_user_record(NULL, NULL, from);
/* Search existing memberlists for matching nick */
for (chan = chanset; chan; chan = chan->next) {
for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
if (!rfc_casecmp(m->nick, nick)) {
found = 1;
break;
}
}
if (found) {
break;
}
}
u = lookup_user_record(m, NULL, from);
code = newsplit(&msg);
rmspace(msg);

Expand All @@ -694,7 +708,9 @@ static int gotnotice(char *from, char *msg)
{
char *to, *nick, ctcpbuf[512], *p, *p1, buf[512], *uhost = buf, *ctcp;
struct userrec *u;
int ignoring;
struct chanset_t *chan;
memberlist *m;
int found = 0, ignoring;

/* Notice to a channel, not handled here */
if (msg[0] && ((strchr(CHANMETA, *msg) != NULL) || (*msg == '@')))
Expand Down Expand Up @@ -766,7 +782,19 @@ static int gotnotice(char *from, char *msg)
}

detect_flood(nick, uhost, from, FLOOD_NOTICE);
u = get_user_by_host(from);
for (chan = chanset; chan; chan = chan->next) {
for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
if (!rfc_casecmp(m->nick, nick)) {
found = 1;
break;
}
}
if (found) {
break;
}
}

u = lookup_user_record(m, NULL, from);

if (!ignoring || trigger_on_ignore)
if (check_tcl_notc(nick, uhost, u, botname, msg) == 2)
Expand Down

0 comments on commit f6e48c6

Please sign in to comment.