fixed a bug with users quiting who where part of multiple channels

This commit is contained in:
fishwaldo 2002-03-11 08:02:40 +00:00
parent a2e6f4f244
commit 9e3145501c
3 changed files with 36 additions and 19 deletions

29
chans.c
View file

@ -5,7 +5,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: chans.c,v 1.7 2002/03/11 06:55:04 fishwaldo Exp $
** $Id: chans.c,v 1.8 2002/03/11 08:02:40 fishwaldo Exp $
*/
#include <fnmatch.h>
@ -81,7 +81,7 @@ void ChangeChanUserMode(Chans *c, User *u, int add, long mode) {
cmn = list_find(c->chanmembers, u->nick, comparef);
if (!cmn) {
if (me.coder_debug) {
notice("ChangeChanUserMode() %s doesn't seem to be in the Chan %s", u->nick, c->name);
notice(s_Services, "ChangeChanUserMode() %s doesn't seem to be in the Chan %s", u->nick, c->name);
chandump(c->name);
UserDump(u->nick);
}
@ -134,10 +134,13 @@ void part_chan(User *u, char *chan) {
Chans *c;
lnode_t *un;
strcpy(segv_location, "part_chan");
#ifdef DEBUG
log("Parting %s from %s", u->nick, chan);
#endif
if (!u) {
log("Ehh, Parting a Unknown User %s from Chan %s: %s", u->nick, chan, recbuf);
if (me.coder_debug) {
notice("Ehh, Parting a Unknown User %s from Chan %s: %s", u->nick, chan, recbuf);
notice(s_Services, "Ehh, Parting a Unknown User %s from Chan %s: %s", u->nick, chan, recbuf);
chandump(chan);
UserDump(u->nick);
}
@ -152,7 +155,7 @@ void part_chan(User *u, char *chan) {
if (!un) {
log("hu, User %s isn't a member of this channel %s", u->nick, chan);
if (me.coder_debug) {
notice("hu, User %s isn't a member of this channel %s", u->nick, chan);
notice(s_Services, "hu, User %s isn't a member of this channel %s", u->nick, chan);
chandump(c->name);
UserDump(u->nick);
}
@ -167,7 +170,7 @@ void part_chan(User *u, char *chan) {
if (!un) {
log("Hu, User %s claims not to be part of Chan %s", u->nick, chan);
if (me.coder_debug) {
notice("Hu, User %s claims not to be part of Chan %s", u->nick, chan);
notice(s_Services, "Hu, User %s claims not to be part of Chan %s", u->nick, chan);
chandump(c->name);
UserDump(u->nick);
}
@ -184,7 +187,7 @@ void change_user_nick(Chans *c, char *newnick, char *oldnick) {
if (!cm) {
log("change_user_nick() %s isn't a member of %s", oldnick, c->name);
if (me.coder_debug) {
notice("change_user_nick() %s isn't a member of %s", oldnick, c->name);
notice(s_Services, "change_user_nick() %s isn't a member of %s", oldnick, c->name);
chandump(c->name);
UserDump(oldnick);
}
@ -229,16 +232,24 @@ void join_chan(User *u, char *chan) {
if (list_find(c->chanmembers, u->nick, comparef)) {
log("Adding %s to Chan %s when he is already a member?", u->nick, chan);
if (me.coder_debug) {
notice("Adding %s to Chan %s when he is already a member?", u->nick, chan);
notice(s_Services, "Adding %s to Chan %s when he is already a member?", u->nick, chan);
chandump(c->name);
UserDump(u->nick);
}
return;
}
list_prepend(c->chanmembers, un);
if (list_isfull(c->chanmembers)) {
log("ekk, Channel %s Members list is full", c->name);
} else {
list_append(c->chanmembers, un);
}
c->cur_users++;
un = lnode_create(c->name);
list_prepend(u->chans, un);
if (list_isfull(c->chanmembers)) {
log("eek, User %s members list is full", u->nick);
} else {
list_append(u->chans, un);
}
}
void chandump(char *chan) {

8
dl.c
View file

@ -285,7 +285,7 @@ int del_mod_user(char *bot_name) {
int bot_nick_change(char *oldnick, char *newnick)
{
User *u;
Mod_User *mod_tmp, *mod_ptr = NULL;
Mod_User *mod_tmp, *mod_ptr;
strcpy(segv_location, "bot_nick_change");
@ -327,7 +327,7 @@ int bot_nick_change(char *oldnick, char *newnick)
void list_module_bots(User *u) {
Mod_User *mod_ptr = NULL;
Mod_User *mod_ptr;
hnode_t *bn;
hscan_t bs;
strcpy(segv_location, "list_module_bots");
@ -350,9 +350,9 @@ int load_module(char *path1, User *u) {
#ifndef HAVE_LIBDL
const char *dl_error;
#else
char *dl_error = NULL;
char *dl_error;
#endif
void *dl_handle = NULL;
void *dl_handle;
int do_msg;
char *path = NULL;
char p[255];

18
users.c
View file

@ -5,7 +5,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: users.c,v 1.22 2002/03/11 06:55:04 fishwaldo Exp $
** $Id: users.c,v 1.23 2002/03/11 08:02:40 fishwaldo Exp $
*/
#include <fnmatch.h>
@ -81,6 +81,13 @@ void AddUser(const char *nick, const char *user, const char *host, const char *s
}
void part_u_chan(list_t *list, lnode_t *node, User *u) {
#ifdef DEBUG
log("Parting %s", lnode_get(node));
#endif
part_chan(u, lnode_get(node));
}
void DelUser(const char *nick)
{
User *u;
@ -98,11 +105,10 @@ void DelUser(const char *nick)
return;
}
u = hnode_get(un);
cn = list_first(u->chans);
while (cn) {
part_chan(u, lnode_get(cn));
cn = list_next(u->chans, cn);
}
list_process(u->chans, u, part_u_chan);
hash_delete(uh, un);
hnode_destroy(un);
free(u);