Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vanosg committed May 19, 2024
1 parent f70133e commit 4fb20e6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
31 changes: 22 additions & 9 deletions src/mod/irc.mod/chan.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static int detect_chan_flood(char *floodnick, char *floodhost, char *from,
if (!m && (which != FLOOD_JOIN))
return 0;

// XXXXXXXXX Check if m exists first?
// TODO: Check if m exists first, add account argument?
get_user_flagrec(get_user_by_host(from), &fr, chan->dname);
if (glob_bot(fr) || ((which == FLOOD_DEOP) && (glob_master(fr) ||
chan_master(fr)) && (glob_friend(fr) || chan_friend(fr))) ||
Expand Down Expand Up @@ -1236,7 +1236,6 @@ static int gotchghost(char *from, char *msg){
snprintf(m->userhost, sizeof m->userhost, "%s@%s", ident, msg);
snprintf(mask, sizeof mask, "%s %s!%s@%s", chname, nick, ident, msg);
check_tcl_chghost(nick, from, mask, u, chname, ident, msg);
//XXXXXX Duplicative now?
get_user_flagrec(u, &fr, chan->dname);
check_this_member(chan, m->nick, &fr);
}
Expand Down Expand Up @@ -2457,10 +2456,9 @@ static int gotnick(char *from, char *msg)
}
}
if (!found) {
u = get_user_from_channel(m);
s1[0] = '*';
s1[1] = 0;
check_tcl_nick(nick, uhost, u, s1, msg);
check_tcl_nick(nick, uhost, NULL, s1, msg);
}
return 0;
}
Expand Down Expand Up @@ -2559,6 +2557,7 @@ static int gotmsg(char *from, char *msg)
int ctcp_count = 0, ignoring;
struct chanset_t *chan;
struct userrec *u;
memberlist *m;

/* Only handle if message is to a channel, or to @#channel. */
/* FIXME: Properly handle ovNotices (@+#channel), vNotices (+#channel), etc. */
Expand Down Expand Up @@ -2602,8 +2601,15 @@ static int gotmsg(char *from, char *msg)
ctcp_count++;
if (ctcp[0] != ' ') {
code = newsplit(&ctcp);
//XXXXXXXXXXX ctcp doesn't have msg-tags for account, does it? cant' get it here anyway
u = get_user_by_host(from);
u = NULL;
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)) {
u = get_user_from_channel(m);
break;
}
}
}
if (!ignoring || trigger_on_ignore) {
if (!check_tcl_ctcp(nick, uhost, u, to, code, ctcp)) {
chan = findchan(realto);
Expand Down Expand Up @@ -2682,6 +2688,7 @@ static int gotnotice(char *from, char *msg)
char *ctcp, *code;
struct userrec *u;
struct chanset_t *chan;
memberlist *m;
int ignoring;

if (!strchr(CHANMETA "@", *msg))
Expand All @@ -2695,9 +2702,15 @@ static int gotnotice(char *from, char *msg)
fixcolon(msg);
strlcpy(uhost, from, sizeof buf);
nick = splitnick(&uhost);
//XXXXXXXXXX We can't check msg-tags in this proc, and may not be part of a chan
u = get_user_by_host(from);

u = NULL;
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)) {
u = get_user_from_channel(m);
break;
}
}
}
/* Check for CTCP: */
p = strchr(msg, 1);
while (p && *p) {
Expand Down
2 changes: 2 additions & 0 deletions src/mod/irc.mod/mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,8 @@ static int gotmode(char *from, char *origmsg)
u = get_user_from_channel(m);
get_user_flagrec(u, &user, ch);
m->last = now;
} else {
u = NULL;
}
if (m && channel_active(chan) && (me_op(chan) || (me_halfop(chan) &&
!chan_hasop(m))) && !(glob_friend(user) || chan_friend(user) ||
Expand Down
4 changes: 2 additions & 2 deletions src/userrec.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ struct userrec *get_user_from_channel(memberlist *m)
struct userrec *ret;

/* Check if there is a user with a matching account if one is provided */
if (m->account) {
if (m->account[0] != '*') {
ret = get_user_by_account(m->account);
if (ret) {
return ret;
}
}
/* Check if there is a user with a matching hostmask if one is provided */
if (m->userhost && m->nick) {
if ((m->userhost[0] != '\0') && (m->nick[0] != '\0')) {
char s[NICKMAX+UHOSTLEN+1];
sprintf(s, "%s!%s", m->nick, m->userhost);
ret = get_user_by_host(s);
Expand Down

0 comments on commit 4fb20e6

Please sign in to comment.