From c2de53cf85b4ae5afd0f464498c8bf6cded58486 Mon Sep 17 00:00:00 2001 From: codemastr Date: Sun, 29 Oct 2000 18:02:59 +0000 Subject: [PATCH] Fixed the /list showing only 64 channels bug --- Changes | 3 ++- include/h.h | 2 +- src/channel.c | 16 ++++++++-------- src/list.c | 30 +++++------------------------- 4 files changed, 16 insertions(+), 35 deletions(-) diff --git a/Changes b/Changes index b93abe1e1..5fad82c04 100644 --- a/Changes +++ b/Changes @@ -670,4 +670,5 @@ - Fixed the hashing bug (thank you ROXnet ...) - Fixed a wierd channel message bug || - Fixed a bug where non-NS servers would crash when linking -- Added TS2ts (supporting the SJB64 stuff), and fixed the !0 timestamp bug \ No newline at end of file +- Added TS2ts (supporting the SJB64 stuff), and fixed the !0 timestamp bug +- Fixed the /list only showing 64 channels bug! Also sped /list up in the process diff --git a/include/h.h b/include/h.h index 7620984bd..fc0704753 100644 --- a/include/h.h +++ b/include/h.h @@ -272,7 +272,7 @@ extern void free_ban PROTO((Ban *)); extern void free_conf PROTO((aConfItem *)); extern void free_class PROTO((aClass *)); extern void free_user PROTO((anUser *, aClient *)); -extern int find_str_match_link PROTO((Link **, char *)); +extern int find_str_match_link PROTO((Link *, char *)); extern void free_str_list PROTO((Link *)); extern Link *make_link PROTO(()); extern Ban *make_ban PROTO(()); diff --git a/src/channel.c b/src/channel.c index a9cb3362c..6da1f8ba1 100644 --- a/src/channel.c +++ b/src/channel.c @@ -3747,18 +3747,18 @@ char mode_buf[MODEBUFLEN], parabuf[MODEBUFLEN]; continue; if (lopt->nolist && - (find_str_match_link(& - (lopt->nolist), chptr->chname) + (find_str_match_link(lopt->nolist, + chptr->chname) || (chptr->topic ? - find_str_match_link(&(lopt->nolist), + find_str_match_link(lopt->nolist, chptr->topic) : 0))) continue; if (lopt->yeslist && - (!find_str_match_link(& - (lopt->yeslist), chptr->chname) + (!find_str_match_link( + lopt->yeslist, chptr->chname) && - !find_str_match_link(& - (lopt->yeslist), chptr->topic))) + !find_str_match_link( + lopt->yeslist, chptr->topic))) continue; #ifdef LIST_SHOW_MODES mode_buf[0] = '['; @@ -3798,7 +3798,7 @@ char mode_buf[MODEBUFLEN], parabuf[MODEBUFLEN]; } /* All done */ - if (hashnum == CH_MAX); + if (hashnum == CH_MAX) { Link *lp, *next; sendto_one(cptr, rpl_str(RPL_LISTEND), me.name, cptr->name); diff --git a/src/list.c b/src/list.c index a1601c119..179c708fb 100644 --- a/src/list.c +++ b/src/list.c @@ -375,34 +375,14 @@ Link *find_channel_link(lp, ptr) return NULL; } - - -/* - * Look for a match in a list of strings. Go through the list, and run - * match() on it. Side effect: if found, this link is moved to the top of - * the list. - */ -int find_str_match_link(lp, str) - Link **lp; /* Two **'s, since we might modify the original *lp */ - char *str; +/* Based on find_str_link() from bahamut -- codemastr */ +int find_str_match_link(Link *lp, char *charptr) { - Link **head = lp; - if (!str || !lp) + if (!charptr) return 0; - if (lp && *lp) - { - if (!match((*lp)->value.cp, str)) + for (; lp; lp = lp->next) { + if(!match(lp->value.cp, charptr)) return 1; - for (; (*lp)->next; *lp = (*lp)->next) - if (!match((*lp)->next->value.cp, str)) - { - Link *temp = (*lp)->next; - *lp = (*lp)->next->next; - temp->next = *head; - *head = temp; - return 1; - } - return 0; } return 0; }