comparison src/conversation.c @ 1525:ba8e6e211af5

[gaim-migrate @ 1535] icqlib updates. beginnings of system logging. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sat, 03 Mar 2001 00:26:04 +0000
parents b72a33d07ce8
children 249a770bebd7
comparison
equal deleted inserted replaced
1524:a5c87ada5143 1525:ba8e6e211af5
109 return c; 109 return c;
110 110
111 c = (struct conversation *)g_new0(struct conversation, 1); 111 c = (struct conversation *)g_new0(struct conversation, 1);
112 g_snprintf(c->name, sizeof(c->name), "%s", name); 112 g_snprintf(c->name, sizeof(c->name), "%s", name);
113 113
114 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { 114 if ((logging_options & OPT_LOG_ALL) || find_log_info(c->name)) {
115 FILE *fd; 115 FILE *fd;
116 116
117 fd = open_log_file(c->name); 117 fd = open_log_file(c->name);
118 if (fd > 0) { 118 if (fd > 0) {
119 if (!(general_options & OPT_GEN_STRIP_HTML)) 119 if (!(logging_options & OPT_LOG_STRIP_HTML))
120 fprintf(fd, 120 fprintf(fd,
121 "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", 121 "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n",
122 full_date()); 122 full_date());
123 else 123 else
124 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date()); 124 fprintf(fd, " ---- New Conversation @ %s ----\n", full_date());
170 log_conversations = g_list_remove(log_conversations, a); 170 log_conversations = g_list_remove(log_conversations, a);
171 171
172 save_prefs(); 172 save_prefs();
173 173
174 if (cnv) { 174 if (cnv) {
175 if (!(general_options & OPT_GEN_LOG_ALL)) 175 if (!(logging_options & OPT_LOG_ALL))
176 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, cnv->name); 176 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, cnv->name);
177 else 177 else
178 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, cnv->name); 178 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, cnv->name);
179 gtk_window_set_title(GTK_WINDOW(cnv->window), buf); 179 gtk_window_set_title(GTK_WINDOW(cnv->window), buf);
180 } 180 }
231 while (cnv) { 231 while (cnv) {
232 c = (struct conversation *)cnv->data; 232 c = (struct conversation *)cnv->data;
233 233
234 if (c->log_button) 234 if (c->log_button)
235 gtk_widget_set_sensitive(c->log_button, 235 gtk_widget_set_sensitive(c->log_button,
236 ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE); 236 ((logging_options & OPT_LOG_ALL)) ? FALSE : TRUE);
237 237
238 cnv = cnv->next; 238 cnv = cnv->next;
239 } 239 }
240 240
241 while (C) { 241 while (C) {
244 while (bcs) { 244 while (bcs) {
245 c = (struct conversation *)bcs->data; 245 c = (struct conversation *)bcs->data;
246 246
247 if (c->log_button) 247 if (c->log_button)
248 gtk_widget_set_sensitive(c->log_button, 248 gtk_widget_set_sensitive(c->log_button,
249 ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : 249 ((logging_options & OPT_LOG_ALL)) ? FALSE :
250 TRUE); 250 TRUE);
251 251
252 bcs = bcs->next; 252 bcs = bcs->next;
253 } 253 }
254 C = C->next; 254 C = C->next;
1180 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_FONTS; 1180 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_FONTS;
1181 1181
1182 if (display_options & OPT_DISP_IGNORE_SIZES) 1182 if (display_options & OPT_DISP_IGNORE_SIZES)
1183 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_SIZES; 1183 gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_SIZES;
1184 1184
1185 if (!(general_options & OPT_GEN_STRIP_HTML)) 1185 if (!(logging_options & OPT_LOG_STRIP_HTML))
1186 gtk_font_options = gtk_font_options ^ GTK_IMHTML_RETURN_LOG; 1186 gtk_font_options = gtk_font_options ^ GTK_IMHTML_RETURN_LOG;
1187 1187
1188 if (!who) { 1188 if (!who) {
1189 if (flags & WFLAG_SEND) { 1189 if (flags & WFLAG_SEND) {
1190 b = find_buddy(c->gc, c->gc->username); 1190 b = find_buddy(c->gc, c->gc->username);
1209 1209
1210 gtk_imhtml_append_text(GTK_IMHTML(c->text), what, 0); 1210 gtk_imhtml_append_text(GTK_IMHTML(c->text), what, 0);
1211 1211
1212 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0); 1212 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0);
1213 1213
1214 if (general_options & OPT_GEN_STRIP_HTML) { 1214 if (logging_options & OPT_LOG_STRIP_HTML) {
1215 char *t1 = strip_html(what); 1215 char *t1 = strip_html(what);
1216 c->history = g_string_append(c->history, t1); 1216 c->history = g_string_append(c->history, t1);
1217 c->history = g_string_append(c->history, "\n"); 1217 c->history = g_string_append(c->history, "\n");
1218 g_free(t1); 1218 g_free(t1);
1219 } else { 1219 } else {
1220 c->history = g_string_append(c->history, what); 1220 c->history = g_string_append(c->history, what);
1221 c->history = g_string_append(c->history, "<BR>\n"); 1221 c->history = g_string_append(c->history, "<BR>\n");
1222 } 1222 }
1223 1223
1224 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { 1224 if ((logging_options & OPT_LOG_ALL) || find_log_info(c->name)) {
1225 char *t1; 1225 char *t1;
1226 char nm[256]; 1226 char nm[256];
1227 1227
1228 if (general_options & OPT_GEN_STRIP_HTML) { 1228 if (logging_options & OPT_LOG_STRIP_HTML) {
1229 t1 = strip_html(what); 1229 t1 = strip_html(what);
1230 } else { 1230 } else {
1231 t1 = what; 1231 t1 = what;
1232 } 1232 }
1233 if (c->is_chat) 1233 if (c->is_chat)
1234 g_snprintf(nm, 256, "%s.chat", c->name); 1234 g_snprintf(nm, 256, "%s.chat", c->name);
1235 else 1235 else
1236 g_snprintf(nm, 256, "%s", c->name); 1236 g_snprintf(nm, 256, "%s", c->name);
1237 fd = open_log_file(nm); 1237 fd = open_log_file(nm);
1238 if (fd > 0) { 1238 if (fd > 0) {
1239 if (general_options & OPT_GEN_STRIP_HTML) { 1239 if (logging_options & OPT_LOG_STRIP_HTML) {
1240 fprintf(fd, "%s\n", t1); 1240 fprintf(fd, "%s\n", t1);
1241 } else { 1241 } else {
1242 fprintf(fd, "%s<BR>\n", t1); 1242 fprintf(fd, "%s<BR>\n", t1);
1243 } 1243 }
1244 fclose(fd); 1244 fclose(fd);
1245 } 1245 }
1246 if (general_options & OPT_GEN_STRIP_HTML) { 1246 if (logging_options & OPT_LOG_STRIP_HTML) {
1247 g_free(t1); 1247 g_free(t1);
1248 } 1248 }
1249 } 1249 }
1250 1250
1251 } else { 1251 } else {
1300 1300
1301 logstr = gtk_imhtml_append_text(GTK_IMHTML(c->text), what, gtk_font_options); 1301 logstr = gtk_imhtml_append_text(GTK_IMHTML(c->text), what, gtk_font_options);
1302 1302
1303 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0); 1303 gtk_imhtml_append_text(GTK_IMHTML(c->text), "<BR>", 0);
1304 1304
1305 if (general_options & OPT_GEN_STRIP_HTML) { 1305 if (logging_options & OPT_LOG_STRIP_HTML) {
1306 char *t1, *t2; 1306 char *t1, *t2;
1307 t1 = strip_html(buf); 1307 t1 = strip_html(buf);
1308 t2 = strip_html(what); 1308 t2 = strip_html(what);
1309 c->history = g_string_append(c->history, t1); 1309 c->history = g_string_append(c->history, t1);
1310 c->history = g_string_append(c->history, t2); 1310 c->history = g_string_append(c->history, t2);
1322 c->history = g_string_append(c->history, "<BR>\n"); 1322 c->history = g_string_append(c->history, "<BR>\n");
1323 g_free(t1); 1323 g_free(t1);
1324 g_free(t2); 1324 g_free(t2);
1325 } 1325 }
1326 1326
1327 if ((general_options & OPT_GEN_LOG_ALL) || find_log_info(c->name)) { 1327 if ((logging_options & OPT_LOG_ALL) || find_log_info(c->name)) {
1328 char *t1, *t2; 1328 char *t1, *t2;
1329 char *nm = g_malloc(256); 1329 char *nm = g_malloc(256);
1330 if (c->is_chat) 1330 if (c->is_chat)
1331 g_snprintf(nm, 256, "%s.chat", c->name); 1331 g_snprintf(nm, 256, "%s.chat", c->name);
1332 else 1332 else
1333 g_snprintf(nm, 256, "%s", c->name); 1333 g_snprintf(nm, 256, "%s", c->name);
1334 1334
1335 if (general_options & OPT_GEN_STRIP_HTML) { 1335 if (logging_options & OPT_LOG_STRIP_HTML) {
1336 t1 = strip_html(buf); 1336 t1 = strip_html(buf);
1337 t2 = strip_html(what); 1337 t2 = strip_html(what);
1338 } else { 1338 } else {
1339 t1 = html_logize(buf); 1339 t1 = html_logize(buf);
1340 t2 = html_logize(what); 1340 t2 = html_logize(what);
1341 } 1341 }
1342 fd = open_log_file(nm); 1342 fd = open_log_file(nm);
1343 if (fd > 0) { 1343 if (fd > 0) {
1344 if (general_options & OPT_GEN_STRIP_HTML) { 1344 if (logging_options & OPT_LOG_STRIP_HTML) {
1345 fprintf(fd, "%s%s\n", t1, t2); 1345 fprintf(fd, "%s%s\n", t1, t2);
1346 } else { 1346 } else {
1347 fprintf(fd, "%s%s%s<BR>\n", t1, t2, logstr->str); 1347 fprintf(fd, "%s%s%s<BR>\n", t1, t2, logstr->str);
1348 g_string_free(logstr, TRUE); 1348 g_string_free(logstr, TRUE);
1349 } 1349 }
1597 c->link = link; 1597 c->link = link;
1598 c->wood = wood; 1598 c->wood = wood;
1599 c->font = font; 1599 c->font = font;
1600 c->smiley = smiley; 1600 c->smiley = smiley;
1601 1601
1602 gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE); 1602 gtk_widget_set_sensitive(c->log_button, ((logging_options & OPT_LOG_ALL)) ? FALSE : TRUE);
1603 1603
1604 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE); 1604 gtk_widget_set_sensitive(c->bold, ((font_options & OPT_FONT_BOLD)) ? FALSE : TRUE);
1605 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE); 1605 gtk_widget_set_sensitive(c->italic, ((font_options & OPT_FONT_ITALIC)) ? FALSE : TRUE);
1606 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE); 1606 gtk_widget_set_sensitive(c->underline, ((font_options & OPT_FONT_UNDERLINE)) ? FALSE : TRUE);
1607 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE); 1607 gtk_widget_set_sensitive(c->strike, ((font_options & OPT_FONT_STRIKE)) ? FALSE : TRUE);
1803 gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim"); 1803 gtk_window_set_wmclass(GTK_WINDOW(win), "conversation", "Gaim");
1804 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE); 1804 gtk_window_set_policy(GTK_WINDOW(win), TRUE, TRUE, TRUE);
1805 gtk_container_border_width(GTK_CONTAINER(win), 10); 1805 gtk_container_border_width(GTK_CONTAINER(win), 10);
1806 gtk_widget_realize(win); 1806 gtk_widget_realize(win);
1807 aol_icon(win->window); 1807 aol_icon(win->window);
1808 if ((find_log_info(c->name)) || ((general_options & OPT_GEN_LOG_ALL))) 1808 if ((find_log_info(c->name)) || ((logging_options & OPT_LOG_ALL)))
1809 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name); 1809 g_snprintf(buf, sizeof(buf), LOG_CONVERSATION_TITLE, c->name);
1810 else 1810 else
1811 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name); 1811 g_snprintf(buf, sizeof(buf), CONVERSATION_TITLE, c->name);
1812 gtk_window_set_title(GTK_WINDOW(win), buf); 1812 gtk_window_set_title(GTK_WINDOW(win), buf);
1813 gtk_signal_connect(GTK_OBJECT(win), "delete_event", GTK_SIGNAL_FUNC(delete_event_convo), c); 1813 gtk_signal_connect(GTK_OBJECT(win), "delete_event", GTK_SIGNAL_FUNC(delete_event_convo), c);