reg_exit_func(hash_cleanup);
}
+int userList_contains(struct userList *list, struct userNode *user)
+{
+ unsigned int ii;
+
+ for (ii = 0; ii < list->used; ++ii) {
+ if (user == list->list[ii]) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
server_link_func_t *slf_list;
unsigned int slf_size = 0, slf_used = 0;
/* Make callbacks for nick changes. Do this with new nick in
* place because that is slightly more useful.
*/
- for (nn=0; nn<ncf2_used; nn++)
+ for (nn=0; (nn<ncf2_used) && !user->dead; nn++)
ncf2_list[nn](user, old_nick);
user->timestamp = now;
if (IsLocal(user) && !no_announce)
free(old_nick);
}
+void
+SVSNickChange(struct userNode* user, const char *new_nick)
+{
+ char *old_nick;
+ unsigned int nn;
+
+ /* don't do anything if there's no change */
+ old_nick = user->nick;
+ if (!strncmp(new_nick, old_nick, NICKLEN))
+ return;
+
+ /* remove old entry from clients dictionary */
+ dict_remove(clients, old_nick);
+#if !defined(WITH_PROTOCOL_P10)
+ /* Remove from uplink's clients dict */
+ dict_remove(user->uplink->users, old_nick);
+#endif
+ /* and reinsert */
+ user->nick = strdup(new_nick);
+ dict_insert(clients, user->nick, user);
+#if !defined(WITH_PROTOCOL_P10)
+ dict_insert(user->uplink->users, user->nick, user);
+#endif
+
+ /* Make callbacks for nick changes. Do this with new nick in
+ * place because that is slightly more useful.
+ */
+ for (nn=0; (nn<ncf2_used) && !user->dead; nn++)
+ ncf2_list[nn](user, old_nick);
+ user->timestamp = now;
+
+ free(old_nick);
+}
+
struct userNode *
GetUserH(const char *nick)
{
{
/* We've received an account stamp for a user; notify
NickServ, which registers the sole account_func
- right now.
+ right now. TODO: This is a bug. This needs to register
+ a proper list not just kill with each call!! -Rubin
P10 Protocol violation if (user->modes & FLAGS_STAMPED) here.
*/
{
unsigned int n;
+ verify(channel);
dict_remove(channels, channel->name);
if (channel->members.used || channel->locks) {
/* go through all channel members and delete them from the channel */
for (n=channel->members.used; n>0; )
- DelChannelUser(channel->members.list[--n]->user, channel, false, 1);
+ DelChannelUser(channel->members.list[--n]->user, channel, NULL, 1);
/* delete all channel bans */
for (n=channel->banlist.used; n>0; )
if (channel->members.used == 1
&& !(channel->modes & MODE_REGISTERED)
- && !(channel->modes & MODE_APASS))
+ && !(channel->modes & MODE_APASS)) {
mNode->modes |= MODE_CHANOP;
+ log_module(MAIN_LOG, LOG_DEBUG, "setting op");
+ }
- for (n=0; n<jf_used; n++) {
+ if (IsLocal(user)) {
+ irc_join(user, channel);
+ }
+
+ for (n=0; (n<jf_used) && !user->dead; n++) {
/* Callbacks return true if they kick or kill the user,
* and we can continue without removing mNode. */
if (jf_list[n](mNode))
return NULL;
}
- if (IsLocal(user))
- irc_join(user, channel);
-
return mNode;
}
struct modeNode* mNode;
unsigned int n;
- if (reason)
+ if (IsLocal(user) && reason)
irc_part(user, channel, reason);
mNode = GetUserMode(channel, user);
irc_topic(service, user, channel, topic);
} else {
for (n=0; n<tf_used; n++)
+ /* A topic change handler can return non-zero to indicate
+ * that it has reverted the topic change, and that further
+ * hooks should not be called.
+ */
if (tf_list[n](user, channel, old_topic))
break;
}