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.49,1.50


From: Colin Leroy <address@hidden>
Subject: [Ayttm-commits] CVS: ayttm/src chat_room.c,1.49,1.50
Date: Wed, 05 Mar 2003 06:27:00 -0500

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

Modified Files:
        chat_room.c 
Log Message:
fix a possible segfault


Index: chat_room.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_room.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- chat_room.c 4 Mar 2003 16:47:51 -0000       1.49
+++ chat_room.c 5 Mar 2003 11:26:54 -0000       1.50
@@ -48,6 +48,7 @@
 static LList * get_contacts( eb_chat_room * room );
 static void handle_focus(GtkWidget *widget, GdkEventFocus * event, gpointer 
userdata);
 static void eb_chat_room_update_window_title(eb_chat_room *ecb, gboolean 
new_message);
+static void init_loginfo(eb_chat_room *chat_room);
 
 static char *last_clicked_fellow = NULL;
 static guint32 last_time_clicked = 0;
@@ -599,6 +600,8 @@
        li->filename = NULL; /* don't care */
        
        memset(&buff, 0, 1024);
+       if (!room->loginfo)
+               init_loginfo(room);
        
        g_snprintf(buff, 1024, "You had a <a href=\"log://%s\">group chat with 
%s</a>.\n",
                        room->loginfo->filename,
@@ -829,10 +832,7 @@
        GtkWidget * separator;
        GtkWidget * entry_box;
        gboolean    enableSoundButton = FALSE;
-       time_t      mytime = time(NULL);
        char      * room_title = NULL;
-       char        buff[2048];
-       char        tmpnam[128];
        
        /*if we are already here, just leave*/
        if(chat_room->connected)
@@ -1111,14 +1111,25 @@
        RUN_SERVICE(chat_room->local_user)->join_chat_room(chat_room);
        gtk_widget_grab_focus(chat_room->entry);
 
-       g_snprintf(tmpnam, 128, "cr_log%lu%d", mytime, total_rooms);
-       make_safe_filename(buff, tmpnam, NULL);
 
-       chat_room->loginfo = g_new0(log_info, 1);
-       chat_room->loginfo->filename = strdup(buff);
-       chat_room->loginfo->log_started = 0;
-       if ((chat_room->loginfo->fp = fopen(buff, "a")) == NULL)
-               perror(buff);
+       init_loginfo(chat_room);
+}
+
+static void init_loginfo(eb_chat_room *chat_room)
+{
+       time_t      mytime = time(NULL);
+       char        buff[2048];
+       char        tmpnam[128];
+
+       if (!chat_room->loginfo) {
+               g_snprintf(tmpnam, 128, "cr_log%lu%d", mytime, total_rooms);
+               make_safe_filename(buff, tmpnam, NULL);
+               chat_room->loginfo = g_new0(log_info, 1);
+               chat_room->loginfo->filename = strdup(buff);
+               chat_room->loginfo->log_started = 0;
+               if ((chat_room->loginfo->fp = fopen(buff, "a")) == NULL)
+                       perror(buff);
+       }
 }
 
 static LList * get_group_contacts(gchar *group, eb_chat_room * room)





reply via email to

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