comparison src/gtkconv.c @ 4383:f7a84034f97f

[gaim-migrate @ 4649] Logging works again. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 22 Jan 2003 01:45:09 +0000
parents 76223649765b
children a3fd5fe57a0b
comparison
equal deleted inserted replaced
4382:76223649765b 4383:f7a84034f97f
3274 struct gaim_gtk_conversation *gtkconv; 3274 struct gaim_gtk_conversation *gtkconv;
3275 GtkWidget *pane = NULL; 3275 GtkWidget *pane = NULL;
3276 GtkWidget *tab_cont; 3276 GtkWidget *tab_cont;
3277 GtkWidget *tabby; 3277 GtkWidget *tabby;
3278 gboolean new_ui; 3278 gboolean new_ui;
3279 3279 GaimConversationType conv_type;
3280 gtkwin = GAIM_GTK_WINDOW(win); 3280 const char *name;
3281
3282 name = gaim_conversation_get_name(conv);
3283 conv_type = gaim_conversation_get_type(conv);
3284 gtkwin = GAIM_GTK_WINDOW(win);
3281 3285
3282 if (conv->ui_data != NULL) { 3286 if (conv->ui_data != NULL) {
3283 gtkconv = (struct gaim_gtk_conversation *)conv->ui_data; 3287 gtkconv = (struct gaim_gtk_conversation *)conv->ui_data;
3284 3288
3285 tab_cont = gtkconv->tab_cont; 3289 tab_cont = gtkconv->tab_cont;
3292 3296
3293 /* Setup some initial variables. */ 3297 /* Setup some initial variables. */
3294 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); 3298 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
3295 gtkconv->tooltips = gtk_tooltips_new(); 3299 gtkconv->tooltips = gtk_tooltips_new();
3296 3300
3297 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { 3301 if (conv_type == GAIM_CONV_CHAT) {
3298 gtkconv->u.chat = g_malloc0(sizeof(struct gaim_gtk_chat_pane)); 3302 gtkconv->u.chat = g_malloc0(sizeof(struct gaim_gtk_chat_pane));
3299 3303
3300 pane = setup_chat_pane(conv); 3304 pane = setup_chat_pane(conv);
3301 } 3305 }
3302 else if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { 3306 else if (conv_type == GAIM_CONV_IM) {
3303 gtkconv->u.im = g_malloc0(sizeof(struct gaim_gtk_im_pane)); 3307 gtkconv->u.im = g_malloc0(sizeof(struct gaim_gtk_im_pane));
3304 gtkconv->u.im->a_virgin = TRUE; 3308 gtkconv->u.im->a_virgin = TRUE;
3305 3309
3306 pane = setup_im_pane(conv); 3310 pane = setup_im_pane(conv);
3307 } 3311 }
3308 3312
3309 if (pane == NULL) { 3313 if (pane == NULL) {
3310 if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { 3314 if (conv_type == GAIM_CONV_CHAT) {
3311 g_free(gtkconv->u.chat); 3315 g_free(gtkconv->u.chat);
3312 } 3316 }
3313 else if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { 3317 else if (conv_type == GAIM_CONV_IM) {
3314 g_free(gtkconv->u.im); 3318 g_free(gtkconv->u.im);
3315 }; 3319 };
3316 3320
3317 g_free(gtkconv); 3321 g_free(gtkconv);
3318 conv->ui_data = NULL; 3322 conv->ui_data = NULL;
3319 3323
3320 return; 3324 return;
3325 }
3326
3327 /*
3328 * Write the New Conversation log string.
3329 *
3330 * This should probably be elsewhere, but then, logging should
3331 * be moved out in some way, either via plugin or via a new API.
3332 */
3333 if (gaim_conversation_is_logging(conv) &&
3334 conv_type != GAIM_CONV_MISC) {
3335
3336 FILE *fd;
3337 char filename[256];
3338
3339 g_snprintf(filename, sizeof(filename), "%s%s", name,
3340 (conv_type == GAIM_CONV_CHAT ? ".chat" : ""));
3341
3342 fd = open_log_file(filename, (conv_type == GAIM_CONV_CHAT));
3343
3344 if (fd) {
3345 if (!(logging_options & OPT_LOG_STRIP_HTML))
3346 fprintf(fd,
3347 "<HR><BR><H3 Align=Center> "
3348 "---- New Conversation @ %s ----</H3><BR>\n",
3349 full_date());
3350 else
3351 fprintf(fd, "---- New Conversation @ %s ----\n",
3352 full_date());
3353
3354 fclose(fd);
3355 }
3321 } 3356 }
3322 3357
3323 /* Setup the container for the tab. */ 3358 /* Setup the container for the tab. */
3324 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 5); 3359 gtkconv->tab_cont = tab_cont = gtk_vbox_new(FALSE, 5);
3325 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 5); 3360 gtk_container_set_border_width(GTK_CONTAINER(tab_cont), 5);