ayttm-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ayttm-commits] CVS: ayttm/modules/workwizu workwizu.c,1.17,1.18


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/modules/workwizu workwizu.c,1.17,1.18
Date: Mon, 27 Jan 2003 04:31:40 -0500

Update of /cvsroot/ayttm/ayttm/modules/workwizu
In directory subversions:/tmp/cvs-serv25703

Modified Files:
        workwizu.c 
Log Message:
specific debug setting for wwz


Index: workwizu.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/modules/workwizu/workwizu.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- workwizu.c  25 Jan 2003 10:21:11 -0000      1.17
+++ workwizu.c  27 Jan 2003 09:31:38 -0000      1.18
@@ -19,8 +19,6 @@
  *
  */
 
-#define DEBUG  1
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -87,6 +85,9 @@
 int plugin_init();
 int plugin_finish();
 
+int do_wwz_debug = 0;
+#define DBG_WWZ do_wwz_debug
+
 static int ref_count = 0;
 static tag_info tags[21];
 
@@ -120,7 +121,8 @@
        int count;
        input_list *il = g_new0(input_list, 1);
        
-       eb_debug(DBG_MOD, "Workwizu init\n");
+       eb_debug(DBG_WWZ, "Workwizu init\n");
+       
        ref_count=0;
        for(count=0;count<20;count++)
                tags[count].fd=-1;
@@ -145,12 +147,20 @@
        il->widget.entry.name = "owner";
        il->widget.entry.label = _("Distbase:");
        il->type = EB_INPUT_ENTRY;
+       
+       il->next = g_new0(input_list, 1);
+       il = il->next;
+       il->widget.checkbox.value = &do_wwz_debug;
+       il->widget.checkbox.name = "do_wwz_debug";
+       il->widget.checkbox.label = _("Enable debugging");
+       il->type = EB_INPUT_CHECKBOX;
+
        return(0);
 }
 
 int plugin_finish()
 {
-       eb_debug(DBG_MOD, "Returning the ref_count: %i\n", ref_count);
+       eb_debug(DBG_WWZ, "Returning the ref_count: %i\n", ref_count);
        return(ref_count);
 }
 
@@ -164,7 +174,7 @@
   {
     if(read(sock, &c, 1)<1)
     {
-      eb_debug(DBG_MOD,"What the..?!\n"); //DEBUG
+      eb_debug(DBG_WWZ,"What the..?!\n"); //DEBUG
       return NULL;
     }
     if(c=='\r') { continue; }
@@ -173,14 +183,14 @@
     pos++;
   }
   line = strdup(buf);
-  eb_debug(DBG_MOD,"READ :%s\n",line);
+  eb_debug(DBG_WWZ,"READ :%s\n",line);
   return line;
 }
 
 void sock_write (int sock, char *buf)
 {
        eb_local_account *account;
-       eb_debug(DBG_MOD,"WRITE:%s\n",buf);
+       eb_debug(DBG_WWZ,"WRITE:%s\n",buf);
        if (write(sock, buf, strlen(buf)) == -1) {
                perror("write");
                account = find_local_account_by_handle(my_user->username, 
SERVICE_INFO.protocol_id);
@@ -208,7 +218,7 @@
        }
        if (hash < 0) res = -hash;
        else res = hash;
-       eb_debug(DBG_MOD,"getHash %llu \n", res);
+       eb_debug(DBG_WWZ,"getHash %llu \n", res);
        return res;
 }
 
@@ -318,12 +328,12 @@
        ela = find_local_account_by_handle(my_user->username, 
SERVICE_INFO.protocol_id);
        ea = find_account_by_handle(sfrom, SERVICE_INFO.protocol_id);
        if (!ea) {
-               eb_debug(DBG_MOD, "no account found for %s\n",sfrom);
+               eb_debug(DBG_WWZ, "no account found for %s\n",sfrom);
                g_free(sfrom);
                return;
        }
        if (!ela) {
-               eb_debug(DBG_MOD, "no local account found for 
%s\n",my_user->username);
+               eb_debug(DBG_WWZ, "no local account found for 
%s\n",my_user->username);
                g_free(sfrom);
                return;
        }
@@ -386,7 +396,7 @@
        to = atoi(tokens[2]);
        data = g_strdup(tokens[3]);
        g_strfreev(tokens);
-       eb_debug(DBG_MOD,"tag:%d, to:%d,from:%d,data:%s\n",
+       eb_debug(DBG_WWZ,"tag:%d, to:%d,from:%d,data:%s\n",
                          tag,to,from,data);
        switch(tag) {
                case NEWUSER:
@@ -400,11 +410,11 @@
                        get_message(from, to, data);
                        break;
                case ALLOWSPEAK:
-                       eb_debug(DBG_MOD,"yeah, right to speak\n");
+                       eb_debug(DBG_WWZ,"yeah, right to speak\n");
                        my_user->has_speak = 1;
                        break;
                case STOPSPEAK:
-                       eb_debug(DBG_MOD,"server told me to shut up\n");
+                       eb_debug(DBG_WWZ,"server told me to shut up\n");
                        my_user->has_speak = 0;
                        break;
                case USERSTATE:
@@ -421,7 +431,7 @@
        eb_local_account *account = 
find_local_account_by_handle(my_user->username, SERVICE_INFO.protocol_id);
        switch(connstate) {
                case CONN_CLOSED: 
-                       eb_debug(DBG_MOD,"uh? conn is closed\n");
+                       eb_debug(DBG_WWZ,"uh? conn is closed\n");
                        break;
                case CONN_WAITING_CHALLENGE:
                        line = sock_read(sock);
@@ -433,7 +443,7 @@
                        }
                        strcpy(my_user->challenge,line);
                        free(line);
-                       eb_debug(DBG_MOD,"read challenge 
%s\n",my_user->challenge);
+                       eb_debug(DBG_WWZ,"read challenge 
%s\n",my_user->challenge);
                        workwizu_answer_challenge(sock);
                        break;
                case CONN_WAITING_USERINFO:
@@ -468,14 +478,14 @@
                        free(line);
                        break;
                default:
-                       eb_debug(DBG_MOD,"unknown connection state ! :(\n");
+                       eb_debug(DBG_WWZ,"unknown connection state ! :(\n");
                        break;
        }
 }
 
 void eb_workwizu_incoming(void *data, int source, eb_input_condition condition)
 {
-/*     eb_debug(DBG_MOD,"eb_workwizu_incoming r%d w%d e%d\n", 
+/*     eb_debug(DBG_WWZ,"eb_workwizu_incoming r%d w%d e%d\n", 
                        condition&EB_INPUT_READ, 
                        condition&EB_INPUT_WRITE, 
                        condition&EB_INPUT_EXCEPTION);   */
@@ -489,7 +499,7 @@
 void register_sock(int s, int reading, int writing)
 {
   int a;
-  eb_debug(DBG_MOD, "Registering sock %i\n", s);
+  eb_debug(DBG_WWZ, "Registering sock %i\n", s);
   for(a=0; a<20; a++)
   {
     if(tags[a].fd==-1) {
@@ -507,7 +517,7 @@
          tags[a].tag_w=eb_input_add(s, EB_INPUT_WRITE, eb_workwizu_incoming, 
NULL);
         }
 
-        eb_debug(DBG_MOD, "Successful %i\n", s);
+        eb_debug(DBG_WWZ, "Successful %i\n", s);
        return;
     }
   }
@@ -516,7 +526,7 @@
 void unregister_sock(int s)
 {
   int a;
-  eb_debug(DBG_MOD, "Unregistering sock %i\n", s);
+  eb_debug(DBG_WWZ, "Unregistering sock %i\n", s);
   for(a=0; a<20; a++)
   {
     if(tags[a].fd==s) {
@@ -524,7 +534,7 @@
         if(tags[a].tag_w!=-1) { eb_input_remove(tags[a].tag_w); }
        tags[a].fd=-1;
        tags[a].tag_r=tags[a].tag_w=0;
-        eb_debug(DBG_MOD, "Successful %i\n", s);
+        eb_debug(DBG_WWZ, "Successful %i\n", s);
        return;
     }
   }
@@ -535,7 +545,7 @@
   struct sockaddr_in sa;
   struct hostent     *hp;
   int s;
-  eb_debug(DBG_MOD,"Connecting to %s...\n", hostname);
+  eb_debug(DBG_WWZ,"Connecting to %s...\n", hostname);
   if ((hp= gethostbyname(hostname)) == NULL) { /* do we know the host's */
 #ifndef __MINGW32__
     errno= ECONNREFUSED;                       /* address? */
@@ -570,11 +580,11 @@
       {
         if(pfd.revents&POLLERR||pfd.revents&POLLHUP||pfd.revents&POLLNVAL)
         {
-          eb_debug(DBG_MOD, "Error!\n");
+          eb_debug(DBG_WWZ, "Error!\n");
           close(s);
           return -1;
         } else {
-          eb_debug(DBG_MOD, "Connect went fine\n");
+          eb_debug(DBG_WWZ, "Connect went fine\n");
           sleep(2);
           return s;
         }
@@ -602,10 +612,10 @@
        strcpy(my_user->username, account->handle);
        strcpy(my_user->password, wad->password);
 
-       eb_debug(DBG_MOD, "Logging in\n");
+       eb_debug(DBG_WWZ, "Logging in\n");
        wad->sock = connect_socket(server, atoi(port));
        if (wad->sock == -1) {
-               eb_debug(DBG_MOD, "wad->sock=-1 !\n");
+               eb_debug(DBG_WWZ, "wad->sock=-1 !\n");
                return;
        }
        ref_count++;
@@ -639,7 +649,7 @@
        wwz_account_data *wad = (wwz_account_data *) 
account->protocol_local_account_data;
        if (!account->connected) 
                return;
-       eb_debug(DBG_MOD, "Logging out\n");
+       eb_debug(DBG_WWZ, "Logging out\n");
        for (l = wwz_contacts; l && l->data; l = l->next) {
                eb_account * ea = (eb_account *)find_account_by_handle((char 
*)l->data, SERVICE_INFO.protocol_id);
                if(ea) {
@@ -773,7 +783,7 @@
        ea->status_handler = -1;
        user->uid = atoi(ea->handle);
        ea->protocol_account_data = user;
-       eb_debug(DBG_MOD,"eb_workwizu_read_config for %s\n",ea->handle);
+       eb_debug(DBG_WWZ,"eb_workwizu_read_config for %s\n",ea->handle);
        return ea;
 }
 
@@ -846,7 +856,7 @@
        ea->online = FALSE;
        user->uid = atoi(ea->handle);
        ea->protocol_account_data = user;
-       eb_debug(DBG_MOD,"eb_workwizu_new_account for %s\n",ea->handle);
+       eb_debug(DBG_WWZ,"eb_workwizu_new_account for %s\n",ea->handle);
        return ea;
 }
 
@@ -943,7 +953,7 @@
        wwz_account_data *wad = (wwz_account_data 
*)account->protocol_local_account_data;
        
        if (wad->chat_room != NULL) {
-               eb_debug(DBG_MOD,"return existing CR %p\n",wad->chat_room);
+               eb_debug(DBG_WWZ,"return existing CR %p\n",wad->chat_room);
                return wad->chat_room;
        }
        ecr = g_new0(eb_chat_room, 1);
@@ -951,7 +961,7 @@
        ecr->fellows = NULL;
        ecr->connected = FALSE;
        ecr->chat_room_account = account;
-       eb_debug(DBG_MOD,"ecr->chat_room_account %p\n",ecr->chat_room_account);
+       eb_debug(DBG_WWZ,"ecr->chat_room_account %p\n",ecr->chat_room_account);
        wad->chat_room = ecr;
        
        eb_join_chat_room(ecr);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]