Skip to content

Commit

Permalink
fixes for removing ->user
Browse files Browse the repository at this point in the history
  • Loading branch information
vanosg committed May 18, 2024
1 parent 4f7ed02 commit c44941f
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 28 deletions.
14 changes: 7 additions & 7 deletions src/chanprog.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,14 @@ void set_chanlist(const char *host, struct userrec *rec)
memberlist *m;
struct chanset_t *chan;

strlcpy(buf, host, sizeof buf);
uhost = buf;
nick = splitnick(&uhost);
for (chan = chanset; chan; chan = chan->next)
for (m = chan->channel.member; m && m->nick[0]; m = m->next)
if (!rfc_casecmp(nick, m->nick) && !strcasecmp(uhost, m->userhost))
// strlcpy(buf, host, sizeof buf);
// uhost = buf;
// nick = splitnick(&uhost);
// for (chan = chanset; chan; chan = chan->next)
// for (m = chan->channel.member; m && m->nick[0]; m = m->next)
// if (!rfc_casecmp(nick, m->nick) && !strcasecmp(uhost, m->userhost))
//XXXXXXXX Does this whole func come out?
m->user = rec;
// m->user = rec;
}

/* Calculate the memory we should be using
Expand Down
2 changes: 1 addition & 1 deletion src/mod/channels.mod/tclchan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ static int tcl_do_masklist(maskrec *m, Tcl_Interp *irp)
list[3] = ts1;
snprintf(ts2, sizeof ts2, "%" PRId64, (int64_t) m->lastactive);
list[4] = ts2;
list[5] = get_user_from_channel(m);
list[5] = m->user;
p = Tcl_Merge(6, list);
Tcl_AppendElement(irp, p);
Tcl_Free((char *) p);
Expand Down
5 changes: 3 additions & 2 deletions src/mod/irc.mod/chan.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ static void recheck_channel(struct chanset_t *chan, int dobans)
{
memberlist *m;
struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };
struct userrec *u;
static int stacking = 0;
int stop_reset = 0;

Expand All @@ -910,10 +911,10 @@ static void recheck_channel(struct chanset_t *chan, int dobans)
stacking++;
/* Okay, sort through who needs to be deopped. */
for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
if (!get_user_from_channel(m) && !m->tried_getuser) {
if (!m->tried_getuser) {
m->tried_getuser = 1;
u = get_user_from_channel(m);
}
u = get_user_from_channel(m);
get_user_flagrec(u, &fr, chan->dname);
if (glob_bot(fr) && chan_hasop(m) && !match_my_nick(m->nick))
stop_reset = 1;
Expand Down
1 change: 0 additions & 1 deletion src/mod/irc.mod/cmdsirc.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,6 @@ static void cmd_channel(struct userrec *u, int idx, char *par)
char handle[HANDLEN + 1], s[UHOSTLEN], s1[UHOSTLEN], atrflag, chanflag;
struct chanset_t *chan;
memberlist *m;
struct userrec *u;
int maxnicklen, maxhandlen;

chan = get_channel(idx, par);
Expand Down
4 changes: 2 additions & 2 deletions src/mod/irc.mod/irc.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ static void punish_badguy(struct chanset_t *chan, char *whobad,
fr.chan = USER_DEOP;
fr.udef_chan = 0;
u = get_user_by_handle(userlist, s1);
if ((mx = ismember(chan, badnick)))
mx->user = u;
// if ((mx = ismember(chan, badnick)))
// mx->user = u;
set_user_flagrec(u, &fr, chan->dname);
simple_sprintf(s, "(%s) %s (%s)", ct, reason, whobad);
set_user(&USERENTRY_COMMENT, u, (void *) s);
Expand Down
2 changes: 1 addition & 1 deletion src/mod/irc.mod/mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ static int gotmode(char *from, char *origmsg)
refresh_who_chan(chan->name);
} else {
simple_sprintf(s, "%s!%s", m->nick, m->userhost);
get_user_flagrec(get_user_from_channel, &victim, chan->dname);
get_user_flagrec(get_user_from_channel(m), &victim, chan->dname);
if (ms2[0] == '+') {
m->flags &= ~SENTVOICE;
m->flags |= CHANVOICE;
Expand Down
2 changes: 2 additions & 0 deletions src/mod/irc.mod/tclirc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ static int tcl_chanlist STDVAR
int f;
memberlist *m;
struct chanset_t *chan;
struct userrec *u;
struct flag_record plus = { FR_CHAN | FR_GLOBAL | FR_BOT, 0, 0, 0, 0, 0 },
minus = { FR_CHAN | FR_GLOBAL | FR_BOT, 0, 0, 0, 0, 0},
user = { FR_CHAN | FR_GLOBAL | FR_BOT, 0, 0, 0, 0, 0 };
Expand Down Expand Up @@ -1106,6 +1107,7 @@ static int tcl_nick2hand STDVAR
{
memberlist *m;
struct chanset_t *chan, *thechan = NULL;
struct userrec *u;

BADARGS(2, 3, " nick ?channel?");

Expand Down
27 changes: 13 additions & 14 deletions src/userrec.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ static struct userrec *check_chanlist_hand(const char *hand)
memberlist *m;

for (chan = chanset; chan; chan = chan->next)
for (m = chan->channel.member; m && m->nick[0]; m = m->next)
for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
u = get_user_from_channel(m);
if (u && !strcasecmp(u->handle, hand))
return u;
}
return NULL;
}

Expand Down Expand Up @@ -229,11 +230,11 @@ struct userrec *get_user_by_handle(struct userrec *bu, char *handle)
cache_hit++;
return ret;
}
ret = check_chanlist_hand(handle);
if (ret) {
cache_hit++;
return ret;
}
// ret = check_chanlist_hand(handle);
// if (ret) {
// cache_hit++;
// return ret;
// }
cache_miss++;
}
for (u = bu; u; u = u->next)
Expand Down Expand Up @@ -335,12 +336,10 @@ void clear_userlist(struct userrec *bu)

/* Find CLOSEST host match
* (if "*!*@*" and "*!*@*clemson.edu" both match, use the latter!)
*
* Checks the chanlist first, to possibly avoid needless search.
*/
struct userrec *get_user_by_host(char *host)
{
struct userrec *u, *ret;
struct userrec *u, *ret = NULL;
struct list_type *q;
int cnt, i;
char host2[UHOSTLEN];
Expand All @@ -350,12 +349,12 @@ struct userrec *get_user_by_host(char *host)
rmspace(host);
if (!host[0])
return NULL;
ret = check_chanlist(host);
// ret = check_chanlist(host);
cnt = 0;
if (ret != NULL) {
cache_hit++;
return ret;
}
// if (ret != NULL) {
// cache_hit++;
// return ret;
// }
cache_miss++;
strlcpy(host2, host, sizeof host2);
for (u = userlist; u; u = u->next) {
Expand Down

0 comments on commit c44941f

Please sign in to comment.