Bug fix in nick channel nick tracking

This commit is contained in:
nohar 2007-01-27 12:30:12 +00:00
parent 2855993dad
commit a31562f519
2 changed files with 21 additions and 13 deletions

View File

@ -1718,18 +1718,6 @@ static int irc_nick(struct link_server *server, struct line *line)
if (!line->origin)
return ERR_PROTOCOL;
if (origin_is_me(line, server)) {
free(server->nick);
server->nick = strdup(line->elemv[1]);
if (LINK(server)->follow_nick &&
(LINK(server)->away_nick == NULL ||
strcmp(server->nick, LINK(server)->away_nick))
!= 0) {
free(LINK(server)->connect_nick);
LINK(server)->connect_nick = strdup(server->nick);
}
}
for (hash_it_init(&server->channels, &hi); hash_it_item(&hi);
hash_it_next(&hi)) {
channel = hash_it_item(&hi);
@ -1744,6 +1732,18 @@ static int irc_nick(struct link_server *server, struct line *line)
line->elemv[1]);
}
if (origin_is_me(line, server)) {
free(server->nick);
server->nick = strdup(line->elemv[1]);
if (LINK(server)->follow_nick &&
(LINK(server)->away_nick == NULL ||
strcmp(server->nick, LINK(server)->away_nick))
!= 0) {
free(LINK(server)->connect_nick);
LINK(server)->connect_nick = strdup(server->nick);
}
}
return OK_COPY;
}

View File

@ -553,12 +553,20 @@ char *hash_it_key(hash_iterator_t *h)
return hi->key;
}
void hash_dump(hash_t *h)
{
hash_iterator_t it;
for (hash_it_init(h, &it); hash_it_item(&it) ;hash_it_next(&it)) {
void *p = hash_it_item(&it);
printf("%s => %p\n", hash_it_key(&it), hash_it_item(&it));
}
}
char *strmaydup(char *s)
{
if (!s)
return s;
return strdup(s);
}
void strucase(char *s)