ayttm-commits
[Top][All Lists]
Advanced

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

[Ayttm-commits] CVS: ayttm/src chat_room.c,1.44,1.45 chat_room.h,1.12,1.


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/src chat_room.c,1.44,1.45 chat_room.h,1.12,1.13 chat_window.h,1.10,1.11 smileys.c,1.15,1.16 util.c,1.42,1.43
Date: Thu, 06 Feb 2003 04:15:40 -0500

Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv14654/src

Modified Files:
        chat_room.c chat_room.h chat_window.h smileys.c util.c 
Log Message:
chat_window & chat_room structs cleaning


Index: chat_room.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_room.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- chat_room.c 30 Jan 2003 15:03:50 -0000      1.44
+++ chat_room.c 6 Feb 2003 09:15:37 -0000       1.45
@@ -55,7 +55,7 @@
        
        if (!text || strlen(text) == 0)
                return;
-       RUN_SERVICE(ecr->chat_room_account)->send_chat_room_message(ecr,text);
+       RUN_SERVICE(ecr->local_user)->send_chat_room_message(ecr,text);
 
        if(ecr->this_msg_in_history)
        {
@@ -90,8 +90,8 @@
                return;
 
        if(now>=cr->next_typing_send &&
-          RUN_SERVICE(cr->chat_room_account)->send_cr_typing!=NULL) {
-               cr->next_typing_send = 
now+RUN_SERVICE(cr->chat_room_account)->send_cr_typing(cr);
+          RUN_SERVICE(cr->local_user)->send_cr_typing!=NULL) {
+               cr->next_typing_send = 
now+RUN_SERVICE(cr->local_user)->send_cr_typing(cr);
        }
 }
 
@@ -223,8 +223,8 @@
 static void invite_callback( GtkWidget * widget, gpointer data )
 {
        eb_chat_room * ecr = data;
-       RUN_SERVICE(ecr->chat_room_account)->send_invite(
-                               ecr->chat_room_account, ecr,
+       RUN_SERVICE(ecr->local_user)->send_invite(
+                               ecr->local_user, ecr,
                                
gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(ecr->invite_buddy)->entry)),
                                
gtk_entry_get_text(GTK_ENTRY(ecr->invite_message)));
 
@@ -500,7 +500,7 @@
        while (l_list_find(chat_rooms, data)) {
                chat_rooms = l_list_remove(chat_rooms, data);
        }
-       RUN_SERVICE(ecr->chat_room_account)->leave_chat_room(ecr);
+       RUN_SERVICE(ecr->local_user)->leave_chat_room(ecr);
        g_free(ecr);
 }
 
@@ -521,13 +521,13 @@
 static void eb_chat_room_refresh_list(eb_chat_room * room )
 {
        LList * node;
-       gtk_clist_clear(GTK_CLIST(room->online));
+       gtk_clist_clear(GTK_CLIST(room->fellows_widget));
 
        for( node = room->fellows; node; node = node->next )
        {
                eb_chat_room_buddy * ecrb = node->data;
                gchar * list[1] = {ecrb->alias};
-               gtk_clist_append(GTK_CLIST(room->online), list);
+               gtk_clist_append(GTK_CLIST(room->fellows_widget), list);
        }
 }
 
@@ -571,7 +571,7 @@
        if(node && room->fellows)
        {
                eb_chat_room_buddy * ecrb = node->data;
-               eb_account *ea = find_account_by_handle(ecrb->handle, 
room->service_id);
+               eb_account *ea = find_account_by_handle(ecrb->handle, 
room->local_user->service_id);
                if(ea)
                        eb_chat_room_display_status (ea, NULL);
                room->fellows = l_list_remove(room->fellows, ecrb);
@@ -593,7 +593,7 @@
        room_title = g_strdup_printf("%s%s [%s]", 
                        new_message?"* ":"",
                        ecb->room_name, 
-                       get_service_name(ecb->service_id));
+                       get_service_name(ecb->local_user->service_id));
        gtk_window_set_title(GTK_WINDOW(ecb->window), room_title);
        g_free(room_title);
 }
@@ -612,7 +612,6 @@
 
        if( ecb )
        {
-               ecb->service_id = service;
                if (!l_list_find(chat_rooms,ecb)) {
                        chat_rooms = l_list_append(chat_rooms, ecb);
                }
@@ -622,8 +621,8 @@
 
 void eb_chat_room_show_3rdperson( eb_chat_room * chat_room, gchar * message)
 {
-       gtk_eb_html_add(EXT_GTK_TEXT(chat_room->conversation), message,0,0,0 );
-       gtk_eb_html_add(EXT_GTK_TEXT(chat_room->conversation), "\n",0,0,0 );
+       gtk_eb_html_add(EXT_GTK_TEXT(chat_room->chat), message,0,0,0 );
+       gtk_eb_html_add(EXT_GTK_TEXT(chat_room->chat), "\n",0,0,0 );
 }
 
 void eb_chat_room_show_message( eb_chat_room * chat_room,
@@ -635,7 +634,7 @@
        if (!message || strlen(message) == 0)
                return;
 
-       if(!strcmp(chat_room->chat_room_account->handle, user))
+       if(!strcmp(chat_room->local_user->handle, user))
        {
                time_t t;
                struct tm * cur_time;
@@ -645,9 +644,9 @@
                if (iGetLocalPref("do_convo_timestamp")) {
                        g_snprintf(buff, 2048, "<B><FONT 
COLOR=\"#0000FF\">%d:%.2d:%.2d</FONT> <FONT COLOR=\"#0000FF\">%s: </FONT></B>",
                         cur_time->tm_hour, cur_time->tm_min,
-                        cur_time->tm_sec, chat_room->chat_room_account->alias);
+                        cur_time->tm_sec, chat_room->local_user->alias);
                } else {
-                       g_snprintf(buff, 2048, "<FONT COLOR=\"#0000FF\"><B>%s: 
</B></FONT>", chat_room->chat_room_account->alias);
+                       g_snprintf(buff, 2048, "<FONT COLOR=\"#0000FF\"><B>%s: 
</B></FONT>", chat_room->local_user->alias);
                }
        }
        else
@@ -658,8 +657,8 @@
                time_t t;
                struct tm * cur_time;
                
-               if (RUN_SERVICE(chat_room->chat_room_account)->get_color)
-                       color = 
RUN_SERVICE(chat_room->chat_room_account)->get_color();
+               if (RUN_SERVICE(chat_room->local_user)->get_color)
+                       color = RUN_SERVICE(chat_room->local_user)->get_color();
                else 
                        color = "#ff0000";
 
@@ -689,36 +688,23 @@
                        gdk_window_raise(chat_room->window->window);
                 
        }
-       if(RUN_SERVICE(chat_room->chat_room_account)->get_smileys)
-               temp_message = eb_smilify(g_strdup(message), 
RUN_SERVICE(chat_room->chat_room_account)->get_smileys());
+       if(RUN_SERVICE(chat_room->local_user)->get_smileys)
+               temp_message = eb_smilify(g_strdup(message), 
RUN_SERVICE(chat_room->local_user)->get_smileys());
        else
                temp_message = g_strdup(message);
        link_message = linkify(temp_message);
        
-       gtk_eb_html_add(EXT_GTK_TEXT(chat_room->conversation), buff,0,0,0 );
-       gtk_eb_html_add(EXT_GTK_TEXT(chat_room->conversation), link_message,
+       gtk_eb_html_add(EXT_GTK_TEXT(chat_room->chat), buff,0,0,0 );
+       gtk_eb_html_add(EXT_GTK_TEXT(chat_room->chat), link_message,
                iGetLocalPref("do_ignore_back"), 
iGetLocalPref("do_ignore_fore"), iGetLocalPref("do_ignore_font"));
-       gtk_eb_html_add(EXT_GTK_TEXT(chat_room->conversation), "\n",0,0,0 );
+       gtk_eb_html_add(EXT_GTK_TEXT(chat_room->chat), "\n",0,0,0 );
        
        g_free(temp_message);
        
        if(chat_room->sound_enabled 
-       && strcmp(chat_room->chat_room_account->handle, user))
+       && strcmp(chat_room->local_user->handle, user))
        {   
-               if (chat_room->first_message)
-               {
-                       if (chat_room->first_enabled)
-                       {
-                               play_sound(FIRSTMSG);
-                               chat_room->first_message = FALSE;
-                       }
-                       else
-                       {
-                               play_sound(RECEIVE);
-                               chat_room->first_message = FALSE;
-                       }
-               }
-               else if (chat_room->receive_enabled)
+               if (chat_room->receive_enabled)
                        play_sound(RECEIVE);
        }       
 }
@@ -757,7 +743,6 @@
        GdkBitmap * mask;
        GtkWidget * iconwid;
        GtkWidget * send_button;
-       GtkWidget * sound_button;
        GtkWidget * close_button;
        GtkWidget * separator;
        GtkWidget * entry_box;
@@ -780,13 +765,13 @@
        gtk_paned_set_gutter_size(GTK_PANED(hbox), 20);
        
        chat_room->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-       chat_room->online = gtk_clist_new(1);
-       gtk_clist_set_column_title(GTK_CLIST(chat_room->online), 0, 
_("Online"));
-       gtk_widget_set_usize(chat_room->online, 100, 20 );
-       chat_room->conversation = ext_gtk_text_new(NULL, NULL);
-       gtk_widget_set_usize(chat_room->conversation, 400, 200);
-       gtk_eb_html_init(EXT_GTK_TEXT(chat_room->conversation));
-       gtk_container_add(GTK_CONTAINER(scrollwindow), chat_room->conversation);
+       chat_room->fellows_widget = gtk_clist_new(1);
+       gtk_clist_set_column_title(GTK_CLIST(chat_room->fellows_widget), 0, 
_("Online"));
+       gtk_widget_set_usize(chat_room->fellows_widget, 100, 20 );
+       chat_room->chat = ext_gtk_text_new(NULL, NULL);
+       gtk_widget_set_usize(chat_room->chat, 400, 200);
+       gtk_eb_html_init(EXT_GTK_TEXT(chat_room->chat));
+       gtk_container_add(GTK_CONTAINER(scrollwindow), chat_room->chat);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwindow), 
                                                                   
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
 
@@ -849,8 +834,8 @@
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwindow), 
                                                                   
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
 
-       gtk_container_add(GTK_CONTAINER(scrollwindow), chat_room->online );
-       gtk_widget_show(chat_room->online);
+       gtk_container_add(GTK_CONTAINER(scrollwindow), 
chat_room->fellows_widget );
+       gtk_widget_show(chat_room->fellows_widget);
        
 
        gtk_box_pack_start(GTK_BOX(vbox2), scrollwindow, TRUE, TRUE, 3 );
@@ -867,8 +852,8 @@
        gtk_widget_show(vbox2);
 
 
-       gtk_paned_add2(GTK_PANED(hbox), chat_room->online);
-       gtk_widget_show(chat_room->conversation);
+       gtk_paned_add2(GTK_PANED(hbox), chat_room->fellows_widget);
+       gtk_widget_show(chat_room->chat);
 
        
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollwindow),GTK_POLICY_NEVER,
 GTK_POLICY_ALWAYS);
        gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE,TRUE, 3);
@@ -878,7 +863,12 @@
        gtk_widget_show(chat_room->entry);
 
        gtk_widget_realize(chat_room->window);
-       room_title = g_strdup_printf("%s [%s]", chat_room->room_name, 
get_service_name(chat_room->service_id));
+       if (chat_room->local_user)
+               room_title = g_strdup_printf("%s [%s]", chat_room->room_name, 
+                                       
get_service_name(chat_room->local_user->service_id));
+       else
+               room_title = g_strdup_printf("%s", chat_room->room_name);
+       
        gtk_window_set_title(GTK_WINDOW(chat_room->window), room_title);
        g_free(room_title);
        eb_icon(chat_room->window->window);
@@ -928,7 +918,7 @@
        iconwid = gtk_pixmap_new(icon, mask);
        gtk_widget_show(iconwid);
        
-       sound_button = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
+       chat_room->sound_button = 
gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
                                                GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
                                                NULL,
                                                _("Sound"),
@@ -958,7 +948,8 @@
                enableSoundButton = TRUE;
        }
 
-       gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON( sound_button ), 
enableSoundButton );
+       gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON( chat_room->sound_button 
), 
+                                    enableSoundButton );
 
        icon = gdk_pixmap_create_from_xpm_d(chat_room->window->window, &mask, 
NULL, tb_mail_send_xpm);
        iconwid = gtk_pixmap_new(icon, mask);
@@ -1019,20 +1010,20 @@
                eb_debug(DBG_CORE,"!chat_room\n");
                return;
        }
-       if (!chat_room->chat_room_account) {
+       if (!chat_room->local_user) {
                eb_debug(DBG_CORE,"!chat_room->account\n");
                return;
        }
-       if (RUN_SERVICE(chat_room->chat_room_account) == NULL) {
-               
eb_debug(DBG_CORE,"!RUN_SERVICE(chat_room->chat_room_account)\n");
+       if (RUN_SERVICE(chat_room->local_user) == NULL) {
+               eb_debug(DBG_CORE,"!RUN_SERVICE(chat_room->local_user)\n");
                return;
        }
-       if (RUN_SERVICE(chat_room->chat_room_account)->join_chat_room == NULL) {
-               
eb_debug(DBG_CORE,"!RUN_SERVICE(chat_room->chat_room_account)->join_chat_room\n");
+       if (RUN_SERVICE(chat_room->local_user)->join_chat_room == NULL) {
+               
eb_debug(DBG_CORE,"!RUN_SERVICE(chat_room->local_user)->join_chat_room\n");
                return;
        }
        
-       RUN_SERVICE(chat_room->chat_room_account)->join_chat_room(chat_room);
+       RUN_SERVICE(chat_room->local_user)->join_chat_room(chat_room);
        gtk_widget_grab_focus(chat_room->entry);
 
 }
@@ -1052,7 +1043,7 @@
                struct contact * contact = (struct contact *)node->data;
                accounts = contact->accounts;
                while (accounts) {
-                       if( ((struct account *)accounts->data)->service_id == 
room->service_id
+                       if( ((struct account *)accounts->data)->service_id == 
room->local_user->service_id
                        &&  ((struct account *)accounts->data)->online) {
                                newlist = l_list_append(newlist, ((struct 
account *)accounts->data)->handle);   
                        }

Index: chat_room.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_room.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- chat_room.h 29 Jan 2003 19:19:22 -0000      1.12
+++ chat_room.h 6 Feb 2003 09:15:37 -0000       1.13
@@ -39,31 +39,40 @@
 
 typedef struct _eb_chat_room
 {
-       int connected; /* are we currently in this chat room */
-       char id[255];      /* who are we? */
-       int service_id;
-       char room_name[1024];  /* what is this chat room called */
-       GtkWidget * window;
-       GtkWidget * conversation;
-       GtkWidget * entry;
-       GtkWidget * online;  /* CList of online folks */
+       GtkWidget *window;
+       GtkWidget *chat;
+       GtkWidget *entry;
        GtkWidget *smiley_button;
        GtkWidget *smiley_window;
-       GtkWidget * status_label;
-       LList * typing_fellows;
+       GtkWidget *sound_button;
+       GtkWidget *status_label;
+       
+       /* sound stuff */
+       int sound_enabled;
+       int send_enabled;
+       int first_enabled;
+       int receive_enabled;
+
+       eb_local_account * local_user; /* who are we talking as? */
+       
+       time_t next_typing_send; 
        LList * history;
        LList * hist_pos;
        int this_msg_in_history;
+
+       /* begin chat room specific stuff */
+       
+       int connected; /* are we currently in this chat room */
+       char id[255];      /* who are we? 
+       /*int service_id;*/
+
+       char room_name[1024];  /* what is this chat room called */
        LList * fellows;   /* who is in the chat room */
-       eb_local_account * chat_room_account; /* who are we talking as? */
+       GtkWidget *fellows_widget;  /* CList of online folks */
+       LList * typing_fellows;
+
        void *protocol_local_chat_room_data; /* For protocol-specific storage */
 
-       /* sound stuff */
-       int sound_enabled;
-       int send_enabled;
-       int first_enabled;
-       int receive_enabled;
-       int first_message;
        /*
         * the folloing data members is for the invite window gui
         * since each chat room may spawn an invite window
@@ -73,7 +82,6 @@
        GtkWidget * invite_window;
        GtkWidget * invite_buddy;
        GtkWidget * invite_message;
-       time_t next_typing_send; 
 
 } eb_chat_room;
 

Index: chat_window.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_window.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- chat_window.h       29 Jan 2003 19:19:22 -0000      1.10
+++ chat_window.h       6 Feb 2003 09:15:37 -0000       1.11
@@ -49,34 +49,35 @@
        GtkWidget *offline_button;
        GtkWidget *status_label;
 
-       gboolean sound_enabled;
-       gboolean send_enabled;
-       gboolean first_enabled;
-       gboolean receive_enabled;
-
-       struct contact * contact;
-       eb_account * preferred; /*for sanity reasons, try using the
-                          most recently used account first */
+       int sound_enabled;
+       int send_enabled;
+       int first_enabled;
+       int receive_enabled;
+       
        eb_local_account * local_user;
-       FILE * fp;
-       gboolean log_started;
 
        time_t next_typing_send;
        LList * history;
        LList * hist_pos;
-       gint this_msg_in_history;
+       int this_msg_in_history;
+
+       /* begin chat window specific stuff */
+       
+       FILE * fp;
+       gboolean log_started;
+
+       struct contact * contact;
+       eb_account * preferred; /*for sanity reasons, try using the
+                                 most recently used account first */
 
        /* Set to FALSE on init, TRUE when away msg first sent,
        FALSE when user sends regular message */
        gint away_msg_sent;
 
-       /*** MIZHI: log window pointer */
        log_window* lw;
 
-       /** MIZHI: notebook */
        GtkWidget* notebook; /* when using tabbed chat, this is the same for 
all chat_window structs. */
        GtkWidget* notebook_child; /* this part is different for each person 
we're talking to */
-       GtkWidget* talk_pixmap; /* depending on whether or not they're being 
talked to is what this is */
 } chat_window;
 
 /* Struct to hold info used by get_local_accounts to hold callback info */

Index: smileys.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/smileys.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- smileys.c   5 Feb 2003 10:47:45 -0000       1.15
+++ smileys.c   6 Feb 2003 09:15:37 -0000       1.16
@@ -380,7 +380,7 @@
        }
 
        if (data && data->c_room)
-               account = data->c_room->chat_room_account;
+               account = data->c_room->local_user;
        else if (data && data->c_window)
                account = data->c_window->local_user;
        else {

Index: util.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/util.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- util.c      6 Feb 2003 08:52:42 -0000       1.42
+++ util.c      6 Feb 2003 09:15:37 -0000       1.43
@@ -583,7 +583,7 @@
        LList * node = chat_rooms;
        for( node= chat_rooms; node && node->data; node=node->next) {
                eb_chat_room * ecr = node->data;
-               if((ecr->chat_room_account->service_id == service_id) && 
!strcmp(name, ecr->room_name) )
+               if((ecr->local_user->service_id == service_id) && !strcmp(name, 
ecr->room_name) )
                        return ecr;
        }
        return NULL;
@@ -597,7 +597,7 @@
        
        for (node = chat_rooms; node && node->data; node = node->next) {
                eb_chat_room *ecr = node->data;
-               if (remote->service_id == ecr->service_id) {
+               if (remote->service_id == ecr->local_user->service_id) {
                        LList *others = NULL;
                        for (others = ecr->fellows; others && others->data; 
others = others->next) {
                                eb_chat_room_buddy *ecrb = others->data;





reply via email to

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