set preferred flag for TestBot
authorpk910 <philipp@zoelle1.de>
Fri, 12 Aug 2011 22:47:49 +0000 (00:47 +0200)
committerpk910 <philipp@zoelle1.de>
Fri, 12 Aug 2011 22:47:49 +0000 (00:47 +0200)
ClientSocket.h
main.c
modcmd.c

index d15be26e866d94151cd342464d94125fd8b97c5e..de08e8c605e504c973b908326b10effcff995471 100644 (file)
@@ -6,7 +6,7 @@
 #define SOCKET_FLAG_DEAD      0x01
 #define SOCKET_FLAG_CONNECTED 0x02
 #define SOCKET_FLAG_READY     0x04
-#define SOCKET_FLAG_PREFERED  0x08 /* prefered bot to send datas to the IRC World (NOTICE's WHO's etc pp) */
+#define SOCKET_FLAG_PREFERRED  0x08 /* prefered bot to send datas to the IRC World (NOTICE's WHO's etc pp) */
 
 #define BUF_SIZ 512
 
diff --git a/main.c b/main.c
index 564e7b0cfa34db3f328ef80cdd13028c93792250..2a9a4d9bc5aad3d893c0cacbfb0cb918307d088a 100644 (file)
--- a/main.c
+++ b/main.c
@@ -16,6 +16,7 @@ void just_test_it() {
     strcpy(user->realname, "testUser!");
     user->flags |= USERFLAG_ISBOT;
     client = create_socket("127.0.0.1", 6667, "pktest:pktest123", user); //pktest Hostmask(s): *@127.0.0.1
+    client->flags |= SOCKET_FLAG_PREFERRED;
     connect_socket(client);
     
     user = addUser("TestBot2");
index 5e5439201699e24c04b90bb2432bdc75fe64d9d1..5efe968e38a7ec832f40101f0e2adaf8137620b1 100644 (file)
--- a/modcmd.c
+++ b/modcmd.c
@@ -27,7 +27,7 @@ static int get_binds_index(char first_char) {
 struct ClientSocket* get_prefered_bot(int botid) {
     struct ClientSocket *client;
     for(client = getBots(SOCKET_FLAG_READY, NULL); client; client = getBots(SOCKET_FLAG_READY, client)) {
-        if(client->botid == botid && (client->flags & SOCKET_FLAG_PREFERED))
+        if(client->botid == botid && (client->flags & SOCKET_FLAG_PREFERRED))
             return client;
     }
     return NULL;
@@ -82,7 +82,7 @@ static void got_chanmsg(struct UserNode *user, struct ChanNode *chan, char *mess
     struct ClientSocket *client;
     FD_ZERO(&fds);
     for(client = getBots(SOCKET_FLAG_READY, NULL); client; client = getBots(SOCKET_FLAG_READY, client)) {
-        if(isUserOnChan(client->user, chan) && (client->flags & SOCKET_FLAG_PREFERED) && !FD_ISSET(client->botid, &fds)) {
+        if(isUserOnChan(client->user, chan) && (client->flags & SOCKET_FLAG_PREFERRED) && !FD_ISSET(client->botid, &fds)) {
             FD_SET(client->botid, &fds);
             trigger = get_channel_trigger(client->botid, chan);
             if(stricmplen(message, trigger, strlen(trigger)) == 0) {