[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Ayttm-commits] CVS: ayttm/src chat_window.c,1.18,1.19 chat_window.h,1.
From: |
Colin Leroy <address@hidden> |
Subject: |
[Ayttm-commits] CVS: ayttm/src chat_window.c,1.18,1.19 chat_window.h,1.3,1.4 log_window.c,1.5,1.6 |
Date: |
Sun, 12 Jan 2003 11:58:59 -0500 |
Update of /cvsroot/ayttm/ayttm/src
In directory subversions:/tmp/cvs-serv4474/src
Modified Files:
chat_window.c chat_window.h log_window.c
Log Message:
fix logging
Index: chat_window.c
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_window.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- chat_window.c 11 Jan 2003 14:52:16 -0000 1.18
+++ chat_window.c 12 Jan 2003 16:58:56 -0000 1.19
@@ -292,17 +292,18 @@
* 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 ? "" : "<P ALIGN=\"CENTER\"><B>"),
+ (stripHTML ? "" : "<B>"),
g_strchomp(asctime(localtime(&my_time))),
- (stripHTML ? "" : "</B></P>"));
+ (stripHTML ? "" : "</B>"));
}
-
+ }
/*
* close the log file
*/
@@ -588,8 +589,7 @@
/* Log the message */
- if ( iGetLocalPref("do_logging") )
- eb_log_message(data->fp, buff, link_message);
+ if ( iGetLocalPref("do_logging") ) eb_log_message(data, buff, link_message);
gtk_editable_delete_text(GTK_EDITABLE (data->entry), 0, -1);
g_free(link_message);
@@ -1766,18 +1766,6 @@
if ((cw->fp = fopen(buff, "a")) == NULL)
{
perror(buff);
- iSetLocalPref("do_logging", 0);
- }
-
- if( iGetLocalPref("do_logging") )
- {
- time_t my_time = time(NULL);
- const int stripHTML = iGetLocalPref("do_strip_html");
-
- fprintf(cw->fp, _("%sConversation started on %s %s\n"),
- (stripHTML ? "" : "<HR WIDTH=\"100%%\"><P ALIGN=\"CENTER\"><B>"),
- g_strchomp(asctime(localtime(&my_time))),
(stripHTML?"":"</B></P>"));
- fflush(cw->fp);
}
gtk_widget_show(cw->chat);
@@ -1979,9 +1967,8 @@
gtk_eb_html_add(EXT_GTK_TEXT(remote_contact->chatwindow->chat),
"<BR>",0,0,0);
/* Log the message */
-
- if ( iGetLocalPref("do_logging") )
- eb_log_message(remote_contact->chatwindow->fp, buff, message);
+ if ( iGetLocalPref("do_logging") )
+ eb_log_message(remote_contact->chatwindow, 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.
@@ -2010,8 +1997,8 @@
/* Log it */
- if ( iGetLocalPref("do_logging") )
- eb_log_message(remote_contact->chatwindow->fp, buff,
gtk_entry_get_text(GTK_ENTRY(away_message)));
+ if ( iGetLocalPref("do_logging") )
+ eb_log_message(remote_contact->chatwindow, buff,
gtk_entry_get_text(GTK_ENTRY(away_message)));
}
free(message);
}
@@ -2133,31 +2120,39 @@
ea->account_contact->chatwindow->fp == NULL)
return;
- eb_log_message(ea->account_contact->chatwindow->fp, ea->handle,
+ eb_log_message(ea->account_contact->chatwindow, ea->handle,
((status && status[0])?status:"Available"));
}
-void eb_log_message(FILE *log_file, gchar buff[], gchar *message)
+void eb_log_message(chat_window *cw, gchar buff[], gchar *message)
{
- gchar *my_name = strdup(buff);
- gchar *my_message = strdup(message);
- const int stripHTML = iGetLocalPref("do_strip_html");
+ 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);
+ }
- /* Get rid of the HTML if the user doesn't want it */
- if ( stripHTML )
+ if (log_file != NULL) {
+ if(!cw->log_started)
{
- strip_html(my_message);
- strip_html(my_name);
- }
-
- /* Log the message, using the appropriate formatting */
- 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);
+ 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);
}
void eb_restore_last_conv(gchar *file_name, chat_window* cw)
@@ -2191,7 +2186,8 @@
}
g_strchomp(buff);
if(!strncmp(buff,_("Conversation started"),strlen(_("Conversation
started")))
- || !strncmp(buff,_("<HR WIDTH=\"100%\"><P
ALIGN=\"CENTER\"><B>Conversation started"),strlen(_("<HR WIDTH=\"100%\"><P
ALIGN=\"CENTER\"><B>Conversation started"))))
+ || !strncmp(buff,_("<HR WIDTH=\"100%%\"><P
ALIGN=\"CENTER\"><B>Conversation started"),strlen(_("<HR WIDTH=\"100%%\"><P
ALIGN=\"CENTER\"><B>Conversation started")))
+ || !strncmp(buff,_("<HR WIDTH=\"100%\"><B>Conversation
started"),strlen(_("<HR WIDTH=\"100%\"><B>Conversation started"))))
{
lastlocation = location;
location = beforeget;
@@ -2200,13 +2196,14 @@
if(lastlocation == -1)
{
- if(location == -1 || location == 0)
+ if(location == -1)
{
fclose(fp);
return;
}
- lastlocation = location;
}
+ if (lastlocation < location)
+ lastlocation = location;
fseek(fp,lastlocation, SEEK_SET);
/* now we display the log */
@@ -2222,11 +2219,18 @@
if(buff[0] == '<') /*this is html*/
{
- if(!strncmp(buff,"<HR WIDTH=\"100%\">",
- strlen("<HR WIDTH=\"100%\">")))
+ if(!strncmp(buff,"<HR WIDTH=\"100%\">", strlen("<HR
WIDTH=\"100%\">")))
{
gtk_eb_html_add(EXT_GTK_TEXT(cw->chat), buff+strlen("<HR
WIDTH=\"100%\">"),0,0,0);
}
+ else if(!strncmp(buff,"<HR WIDTH=\"100%%\"><P ALIGN=\"CENTER\">",
strlen("<HR WIDTH=\"100%%\"><P ALIGN=\"CENTER\">")))
+ {
+ gtk_eb_html_add(EXT_GTK_TEXT(cw->chat), buff+strlen("<HR
WIDTH=\"100%%\"><P ALIGN=\"CENTER\">"),0,0,0);
+ }
+ else if(!strncmp(buff,"<P ALIGN=\"CENTER\">", strlen("<P
ALIGN=\"CENTER\">")))
+ {
+ gtk_eb_html_add(EXT_GTK_TEXT(cw->chat), buff+strlen("<P
ALIGN=\"CENTER\">"),0,0,0);
+ }
else
{
gtk_eb_html_add(EXT_GTK_TEXT(cw->chat), buff, 0,0,0);
@@ -2235,7 +2239,8 @@
gtk_eb_html_add(EXT_GTK_TEXT(cw->chat), "<br>",0,0,0);
- if(strlen(buff) > 34 && !strncmp(buff+34,_("ended on"),8))
+ if(strlen(buff) > strlen(_("<B>Conversation ")) &&
!strncmp(buff+strlen(_("<B>Conversation ")),_("ended on"),8)
+ || strlen(buff) > strlen(_("<P ALIGN=\"CENTER\"><B>Conversation "))
&& !strncmp(buff+strlen(_("<P ALIGN=\"CENTER\"><B>Conversation ")),_("ended
on"),8))
{
break;
}
Index: chat_window.h
===================================================================
RCS file: /cvsroot/ayttm/ayttm/src/chat_window.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- chat_window.h 8 Jan 2003 01:55:19 -0000 1.3
+++ chat_window.h 12 Jan 2003 16:58:56 -0000 1.4
@@ -60,6 +60,7 @@
most recently used account first */
eb_local_account * local_user;
FILE * fp;
+ gboolean log_started;
time_t next_typing_send;
GList * history;
@@ -100,7 +101,7 @@
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( FILE *log_file, gchar buff[], gchar *message );
+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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- log_window.c 3 Jan 2003 23:26:07 -0000 1.5
+++ log_window.c 12 Jan 2003 16:58:56 -0000 1.6
@@ -130,7 +130,7 @@
p1 += strlen(_("Conversation started on "));
/* if html tags are in the buffer, gotta strip the last two tags */
- if ((p2 = strstr(read_buffer, "</B></P>")) != NULL) {
+ if ((p2 = strstr(read_buffer, "</B>")) != NULL) {
strncpy(date_buffer, p1, p2 - p1);
date_buffer[p2-p1] = '\0';
} else {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Ayttm-commits] CVS: ayttm/src chat_window.c,1.18,1.19 chat_window.h,1.3,1.4 log_window.c,1.5,1.6,
Colin Leroy <address@hidden> <=
- Prev by Date:
[Ayttm-commits] CVS: ayttm ChangeLog,1.85,1.86 configure.in,1.83,1.84
- Next by Date:
[Ayttm-commits] CVS: ayttm/src chat_window.c,1.19,1.20
- Previous by thread:
[Ayttm-commits] CVS: ayttm ChangeLog,1.85,1.86 configure.in,1.83,1.84
- Next by thread:
[Ayttm-commits] CVS: ayttm/src chat_window.c,1.19,1.20
- Index(es):