[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src chat_room.c,1.47,1.48 chat_room.h,1.13,1.
From: |
Colin Leroy <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src chat_room.c,1.47,1.48 chat_room.h,1.13,1.14 chat_window.c,1.52,1.53 chat_window.h,1.11,1.12 log_window.c,1.18,1.19 log_window.h,1.6,1.7 |
Date: |
Tue, 04 Mar 2003 10:48:15 -0500 |
Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv20434/src
Modified Files:
chat_room.c chat_room.h chat_window.c chat_window.h
log_window.c log_window.h
Log Message:
clean logging (preparation for chat room logging)
Index: chat_room.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_room.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- chat_room.c 7 Feb 2003 09:00:16 -0000 1.47
+++ chat_room.c 4 Mar 2003 15:48:11 -0000 1.48
@@ -795,6 +795,7 @@
GtkWidget * entry_box;
gboolean enableSoundButton = FALSE;
char * room_title = NULL;
+ gchar buff[2048];
/*if we are already here, just leave*/
if(chat_room->connected)
@@ -1011,8 +1012,6 @@
gtk_widget_show(separator);
gtk_toolbar_append_space(GTK_TOOLBAR(toolbar));
-
-
send_button = gtk_toolbar_append_item(GTK_TOOLBAR(toolbar),
"send",
_("Send Message"),
Index: chat_room.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_room.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- chat_room.h 6 Feb 2003 09:15:37 -0000 1.13
+++ chat_room.h 4 Mar 2003 15:48:11 -0000 1.14
@@ -26,10 +26,11 @@
#define __CHAT_ROOM_H__
#include <gtk/gtk.h>
+#include <stdio.h>
#include <time.h>
#include "account.h"
-
+#include "log_window.h"
typedef struct _eb_chat_room_buddy
{
@@ -59,6 +60,7 @@
LList * history;
LList * hist_pos;
int this_msg_in_history;
+ log_info *loginfo;
/* begin chat room specific stuff */
Index: chat_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_window.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- chat_window.c 26 Feb 2003 19:35:09 -0000 1.52
+++ chat_window.c 4 Mar 2003 15:48:11 -0000 1.53
@@ -277,23 +277,8 @@
* has ended
*/
- if(cw->fp && cw->log_started) {
- if ( iGetLocalPref("do_logging") ) {
- time_t my_time = time(NULL);
- const int stripHTML =
iGetLocalPref("do_strip_html");
- fprintf(cw->fp, _("%sConversation ended on %s %s\n"),
- (stripHTML ? "" : "<B>"),
- g_strchomp(asctime(localtime(&my_time))),
- (stripHTML ? "" : "</B>"));
- }
- }
- /*
- * close the log file
- */
-
- if ((cw->fp != NULL ))
- fclose(cw->fp);
-
+ eb_log_close(cw->loginfo);
+
/*
* and free the memory we allocated to the chat window
* NOTE: a memset is done to flush out bugs related to the
@@ -520,7 +505,6 @@
data->local_user,
data->preferred,
recoded);
- printf("sending %s\n",recoded);
g_free(recoded);
}
/* seems like variable 'text' is not used any more down
@@ -561,7 +545,7 @@
/* Log the message */
if ( iGetLocalPref("do_logging") )
- eb_log_message(data, buff, link_message);
+ eb_log_message(data->loginfo, buff, link_message);
cw_reset_message(data);
g_free(link_message);
@@ -1260,7 +1244,6 @@
{
char *recoded = recode_if_needed(message, RECODE_TO_LOCAL);
g_free(message);
- printf("getting %s\n",recoded);
message = recoded;
}
#endif
@@ -1274,7 +1257,7 @@
/* Log the message */
if ( iGetLocalPref("do_logging") )
- eb_log_message(remote_contact->chatwindow, buff, message);
+ eb_log_message(remote_contact->chatwindow->loginfo, buff,
message);
/* If user's away and hasn't yet sent the away message in the last 5
minutes,
send, display, & log his away message.
@@ -1301,7 +1284,7 @@
/* Log it */
if ( iGetLocalPref("do_logging") )
- eb_log_message(remote_contact->chatwindow, buff,
awaymsg);
+ eb_log_message(remote_contact->chatwindow->loginfo,
buff, awaymsg);
g_free(awaymsg);
}
@@ -1400,44 +1383,14 @@
if(ea == NULL || ea->account_contact == NULL ||
ea->account_contact->chatwindow == NULL ||
- ea->account_contact->chatwindow->fp == NULL)
+ ea->account_contact->chatwindow->loginfo == NULL)
return;
g_snprintf(buff, BUF_SIZE,_("<hr><b>%s changed status to %s @
%s.</b><hr>"),
ea->account_contact->nick, ((status &&
status[0])?status:_("(Online)")),
g_strchomp(asctime(localtime(&my_time))));
- eb_log_message(ea->account_contact->chatwindow, buff,"");
-}
-
-void eb_log_message(chat_window *cw, gchar buff[], gchar *message)
-{
- gchar * my_name = strdup(buff);
- gchar * my_message = strdup(message);
- FILE *log_file = cw->fp;
- const int stripHTML = iGetLocalPref("do_strip_html");
-
- if (stripHTML) {
- strip_html(my_name);
- strip_html(my_message);
- }
-
- if (log_file != NULL) {
- if(!cw->log_started) {
- time_t my_time = time(NULL);
- fprintf(cw->fp, _("%sConversation started on %s %s\n"),
- (stripHTML ? "" : "<HR WIDTH=\"100%\"><B>"),
- g_strchomp(asctime(localtime(&my_time))),
(stripHTML?"":"</B>"));
- fflush(cw->fp);
- cw->log_started = 1;
- }
- fprintf(log_file, "%s %s %s %s\n",
- (stripHTML ? "" : "<P>"), my_name, my_message, (stripHTML ?
"" : "</P>"));
- fflush(log_file);
- }
-
- free(my_message);
- free(my_name);
+ eb_log_message(ea->account_contact->chatwindow->loginfo, buff,"");
}
void eb_restore_last_conv(gchar *file_name, chat_window* cw)
@@ -2136,7 +2089,8 @@
make_safe_filename(buff, remote->nick, remote->group->name);
- if ((cw->fp = fopen(buff, "a")) == NULL)
+ cw->loginfo = g_new0(log_info, 1);
+ if ((cw->loginfo->fp = fopen(buff, "a")) == NULL)
perror(buff);
gtk_widget_show(cw->chat);
Index: chat_window.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_window.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- chat_window.h 6 Feb 2003 09:15:37 -0000 1.11
+++ chat_window.h 4 Mar 2003 15:48:11 -0000 1.12
@@ -60,11 +60,9 @@
LList * history;
LList * hist_pos;
int this_msg_in_history;
+ log_info *loginfo;
/* begin chat window specific stuff */
-
- FILE * fp;
- gboolean log_started;
struct contact * contact;
eb_account * preferred; /*for sanity reasons, try using the
@@ -97,7 +95,6 @@
void eb_chat_window_display_account( eb_account * remote_account );
void eb_chat_window_display_error( eb_account * remote, gchar * message );
void eb_log_status_changed(eb_account *ea, gchar *status );
-void eb_log_message( chat_window *cw, gchar buff[], gchar *message );
void eb_chat_window_do_timestamp( struct contact * c, gboolean online );
void eb_restore_last_conv(gchar *file_name, chat_window* cw);
void send_message(GtkWidget *widget, gpointer d);
Index: log_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/log_window.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- log_window.c 4 Mar 2003 15:12:27 -0000 1.18
+++ log_window.c 4 Mar 2003 15:48:11 -0000 1.19
@@ -34,6 +34,7 @@
#include <gdk/gdkkeysyms.h>
#include <assert.h>
#include <ctype.h>
+#include <time.h>
#include "globals.h"
#include "gtk/gtk_eb_html.h"
@@ -492,4 +493,59 @@
gtk_eb_html_add(EXT_GTK_TEXT(text), tmp,0,0,0);
}
free(tmp);
+}
+
+void eb_log_message(log_info *loginfo, gchar buff[], gchar *message)
+{
+ gchar * my_name = strdup(buff);
+ gchar * my_message = strdup(message);
+ const int stripHTML = iGetLocalPref("do_strip_html");
+
+ if (!loginfo || !loginfo->fp) {
+ free(my_message);
+ free(my_name);
+ return;
+ }
+
+ if (stripHTML) {
+ strip_html(my_name);
+ strip_html(my_message);
+ }
+
+ if(!loginfo->log_started) {
+ time_t my_time = time(NULL);
+ fprintf(loginfo->fp, _("%sConversation started on %s %s\n"),
+ (stripHTML ? "" : "<HR WIDTH=\"100%\"><B>"),
+ g_strchomp(asctime(localtime(&my_time))),
(stripHTML?"":"</B>"));
+ fflush(loginfo->fp);
+ loginfo->log_started = 1;
+ }
+ fprintf(loginfo->fp, "%s %s %s %s\n",
+ (stripHTML ? "" : "<P>"), my_name, my_message, (stripHTML ? "" :
"</P>"));
+ fflush(loginfo->fp);
+
+ free(my_message);
+ free(my_name);
+}
+
+void eb_log_close(log_info *loginfo)
+{
+ if(loginfo && loginfo->fp && loginfo->log_started) {
+ if ( iGetLocalPref("do_logging") ) {
+ time_t my_time = time(NULL);
+ const int stripHTML =
iGetLocalPref("do_strip_html");
+ fprintf(loginfo->fp, _("%sConversation ended on %s
%s\n"),
+ (stripHTML ? "" : "<B>"),
+ g_strchomp(asctime(localtime(&my_time))),
+ (stripHTML ? "" : "</B>"));
+ }
+ }
+ /*
+ * close the log file
+ */
+
+ if (loginfo && loginfo->fp != NULL ) {
+ fclose(loginfo->fp);
+ loginfo->fp = NULL;
+ }
}
Index: log_window.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/log_window.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- log_window.h 4 Mar 2003 15:12:27 -0000 1.6
+++ log_window.h 4 Mar 2003 15:48:11 -0000 1.7
@@ -30,6 +30,7 @@
#include <gtk/gtk.h>
#include <glib.h>
+#include <stdio.h>
struct contact;
@@ -48,9 +49,16 @@
GSList* entries; /* list of gslists */
} log_window;
+typedef struct _log_info
+{
+ FILE *fp;
+ int log_started;
+} log_info;
+
//log_window* eb_log_window_new(struct _chat_window* cw);
log_window* eb_log_window_new(struct contact* rc);
void log_parse_and_add(char *buff, void *text);
void eb_log_load_information(log_window* lw);
-
+void eb_log_message(log_info *loginfo, gchar buff[], gchar *message);
+void eb_log_close(log_info *loginfo);
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src chat_room.c,1.47,1.48 chat_room.h,1.13,1.14 chat_window.c,1.52,1.53 chat_window.h,1.11,1.12 log_window.c,1.18,1.19 log_window.h,1.6,1.7,
Colin Leroy <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm/src browser.c,1.15,1.16 log_window.c,1.17,1.18 log_window.h,1.5,1.6 smileys.c,1.17,1.18 util.c,1.50,1.51
- Next by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.308,1.309 configure.in,1.303,1.304
- Previous by thread:
[Ayttm-commits] CVS: ayttm/src browser.c,1.15,1.16 log_window.c,1.17,1.18 log_window.h,1.5,1.6 smileys.c,1.17,1.18 util.c,1.50,1.51
- Next by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.308,1.309 configure.in,1.303,1.304
- Index(es):