]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/hash.c
Added back missing comment to example config
[irc/evilnet/x3.git] / src / hash.c
index 8a3c7edd74b8e256922d6e5ef4438d23498351be..6e1005ff150f80b1851e0c88ffd3d7e98571ce9e 100644 (file)
@@ -1,7 +1,7 @@
 /* hash.c - IRC network state database
  * Copyright 2000-2004 srvx Development Team
  *
- * This file is part of srvx.
+ * This file is part of x3.
  *
  * srvx is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -692,7 +692,7 @@ reg_topic_func(topic_func_t handler)
 }
 
 void
-SetChannelTopic(struct chanNode *channel, struct userNode *user, const char *topic, int announce)
+SetChannelTopic(struct chanNode *channel, struct userNode *service, struct userNode *user, const char *topic, int announce)
 {
     unsigned int n;
     struct modeNode *mn;
@@ -713,7 +713,7 @@ SetChannelTopic(struct chanNode *channel, struct userNode *user, const char *top
     if (announce) {
        /* We don't really care if a local user messes with the topic,
          * so don't call the tf_list functions. */
-       irc_topic(user, channel, topic);
+       irc_topic(service, user, channel, topic);
     } else {
        for (n=0; n<tf_used; n++)
            if (tf_list[n](user, channel, old_topic))
@@ -757,6 +757,32 @@ GetUserMode(struct chanNode *channel, struct userNode *user)
     return mn;
 }
 
+struct userNode *IsInChannel(struct chanNode *channel, struct userNode *user)
+{
+    unsigned int n;
+
+    verify(channel);
+    verify(channel->members.list);
+    verify(user);
+    verify(user->channels.list);
+    if (channel->members.used < user->channels.used) {
+       for (n=0; n<channel->members.used; n++) {
+            verify(channel->members.list[n]);
+           if (user == channel->members.list[n]->user) {
+                return(user);
+           }
+       }
+    } else {
+       for (n=0; n<user->channels.used; n++) {
+            verify(user->channels.list[n]);
+           if (channel == user->channels.list[n]->channel) {
+                return(user);
+           }
+       }
+    }
+    return NULL;
+}
+
 DEFINE_LIST(userList, struct userNode*)
 DEFINE_LIST(modeList, struct modeNode*)
 DEFINE_LIST(banList, struct banNode*)