annotate src/log.c @ 7469:603a58cd23dc

[gaim-migrate @ 8082] This should fix the problem where some MSN users in the buddy list were showing the offline emblem, indicating that gaim and the server disagree as to whether or not the buddy should be there. That icon was for testing purposes, and should never have been seen by a user. The problem was that in the code, we were looking for a list of all buddies, and would add new ones if not found. The problem was that we'd get duplicates, as some would be in foo@bar.com form, and some in FOO@bar.com form, or mixed-case, or whatever. Now, our msn_normalize() converts a string to lowercase first. We'll see how well this works, but it fixed the problem here. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 10 Nov 2003 22:13:18 +0000
parents f2d82df37252
children ad6435eccf2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
1 /**
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
2 * @file log.c Logging API
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
3 * @ingroup core
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
4 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
5 * gaim
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
6 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
7 * Copyright (C) 2003 Buzz Lightyear
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
8 *
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
9 * This program is free software; you can redistribute it and/or modify
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
10 * it under the terms of the GNU General Public License as published by
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
12 * (at your option) any later version.
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
13 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
14 * This program is distributed in the hope that it will be useful,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
17 * GNU General Public License for more details.
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
18 *
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
19 * You should have received a copy of the GNU General Public License
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
20 * along with this program; if not, write to the Free Software
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 */
4195
4a0837c49d85 [gaim-migrate @ 4426]
Luke Schierer <lschiere@pidgin.im>
parents: 4192
diff changeset
23
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
24 #include "account.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5839
diff changeset
25 #include "debug.h"
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
26 #include "internal.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5839
diff changeset
27 #include "log.h"
5548
80e4ba770f97 [gaim-migrate @ 5949]
Nathan Walp <nwalp@pidgin.im>
parents: 5528
diff changeset
28 #include "prefs.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5839
diff changeset
29 #include "util.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5839
diff changeset
30
7457
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
31 static GaimLogLogger html_logger;
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
32 static GaimLogLogger txt_logger;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
33 static GaimLogLogger old_logger;
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5839
diff changeset
34
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
35 /**************************************************************************
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
36 * PUBLIC LOGGING FUNCTIONS ***********************************************
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
37 **************************************************************************/
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
39 GaimLog *gaim_log_new(GaimLogType type, const char *name, GaimAccount *account, time_t time)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
40 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
41 GaimLog *log = g_new0(GaimLog, 1);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
42 log->name = g_strdup(name);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
43 log->account = account;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
44 log->time = time;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
45 log->logger = gaim_log_logger_get();
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
46 if (log->logger && log->logger->create)
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
47 log->logger->create(log);
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
48 return log;
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 }
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
51 void gaim_log_free(GaimLog *log)
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 {
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
53 g_return_if_fail(log);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
54 if (log->logger && log->logger->finalize)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
55 log->logger->finalize(log);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
56 g_free(log->name);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
57 g_free(log);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
58 }
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
59
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
61 void gaim_log_write(GaimLog *log, GaimMessageFlags type,
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
62 const char *from, time_t time, const char *message)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
63 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
64 g_return_if_fail(log);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
65 g_return_if_fail(log->logger);
7442
d42289ecf0ce [gaim-migrate @ 8047]
Nathan Walp <nwalp@pidgin.im>
parents: 7441
diff changeset
66 g_return_if_fail(log->logger->write);
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
67
7442
d42289ecf0ce [gaim-migrate @ 8047]
Nathan Walp <nwalp@pidgin.im>
parents: 7441
diff changeset
68 (log->logger->write)(log, type, from, time, message);
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 }
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
71 char *gaim_log_read(GaimLog *log, GaimLogReadFlags *flags)
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 {
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
73 g_return_val_if_fail(log && log->logger, NULL);
7462
5fb4cbf1ac54 [gaim-migrate @ 8075]
Nathan Walp <nwalp@pidgin.im>
parents: 7461
diff changeset
74 if (log->logger->read) {
5fb4cbf1ac54 [gaim-migrate @ 8075]
Nathan Walp <nwalp@pidgin.im>
parents: 7461
diff changeset
75 char *ret = (log->logger->read)(log, flags);
5fb4cbf1ac54 [gaim-migrate @ 8075]
Nathan Walp <nwalp@pidgin.im>
parents: 7461
diff changeset
76 gaim_str_strip_linefeed(ret);
5fb4cbf1ac54 [gaim-migrate @ 8075]
Nathan Walp <nwalp@pidgin.im>
parents: 7461
diff changeset
77 return ret;
5fb4cbf1ac54 [gaim-migrate @ 8075]
Nathan Walp <nwalp@pidgin.im>
parents: 7461
diff changeset
78 }
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
79 return (_("<b><font color\"=red\">The logger has no read function</font></b>"));
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 }
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
82 /****************************************************************************
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
83 * LOGGER FUNCTIONS *********************************************************
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
84 ****************************************************************************/
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
86 static GaimLogLogger *current_logger = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
87 static GSList *loggers = NULL;
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
88
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
89 static void logger_pref_cb(const char *name, GaimPrefType type,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
90 gpointer value, gpointer data)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
91 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
92 GaimLogLogger *logger;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
93 GSList *l = loggers;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
94 while (l) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
95 logger = l->data;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
96 if (!strcmp(logger->id, value)) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
97 gaim_log_logger_set(logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
98 return;
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 }
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
100 l = l->next;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
101 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
102 gaim_log_logger_set(&txt_logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
103 }
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
106 GaimLogLogger *gaim_log_logger_new(void(*create)(GaimLog *),
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
107 void(*write)(GaimLog *, GaimMessageFlags, const char *,
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
108 time_t, const char *),
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
109 void(*finalize)(GaimLog *), GList*(*list)(const char*, GaimAccount*),
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
110 char*(*read)(GaimLog*, GaimLogReadFlags*))
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
111 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
112 GaimLogLogger *logger = g_new0(GaimLogLogger, 1);
7440
8c0527c91a92 [gaim-migrate @ 8045]
Nathan Walp <nwalp@pidgin.im>
parents: 7436
diff changeset
113 logger->create = create;
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
114 logger->write = write;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
115 logger->finalize = finalize;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
116 logger->list = list;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
117 logger->read = read;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
118 return logger;
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 }
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
121 void gaim_log_logger_free(GaimLogLogger *logger)
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 {
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
123 g_free(logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
124 }
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
126 void gaim_log_logger_add (GaimLogLogger *logger)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
127 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
128 g_return_if_fail(logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
129 if (g_slist_find(loggers, logger))
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
130 return;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
131 loggers = g_slist_append(loggers, logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
132 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
133
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
134 void gaim_log_logger_remove (GaimLogLogger *logger)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
135 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
136 g_return_if_fail(logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
137 g_slist_remove(loggers, logger);
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138 }
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
140 void gaim_log_logger_set (GaimLogLogger *logger)
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 {
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
142 g_return_if_fail(logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
143 current_logger = logger;
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
144 }
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
146 GaimLogLogger *gaim_log_logger_get()
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
147 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
148 return current_logger;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
149 }
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
151 GList *gaim_log_logger_get_options(void)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
152 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
153 GSList *n;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
154 GList *list = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
155 GaimLogLogger *data;
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
157 for (n = loggers; n; n = n->next) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
158 data = n->data;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
159 if (!data->write)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
160 continue;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
161 list = g_list_append(list, data->name);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
162 list = g_list_append(list, data->id);
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 }
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
165 return list;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
166 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
167
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
168 static gint log_compare(gconstpointer y, gconstpointer z)
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
169 {
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
170 const GaimLog *a = y;
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
171 const GaimLog *b = z;
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
172
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
173 return b->time - a->time;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
174 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
175
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
176 GList *gaim_log_get_logs(const char *name, GaimAccount *account)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
177 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
178 GList *logs = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
179 GSList *n;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
180 for (n = loggers; n; n = n->next) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
181 GaimLogLogger *logger = n->data;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
182 if (!logger->list)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
183 continue;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
184 logs = g_list_concat(logs, logger->list(name, account));
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
185 }
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
186
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
187 return g_list_sort(logs, log_compare);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
188 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
189
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
190 void gaim_log_init(void)
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
191 {
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
192 gaim_prefs_add_none("/core/logging");
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
193 gaim_prefs_add_string("/core/logging/format", "txt");
7457
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
194 gaim_log_logger_add(&html_logger);
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
195 gaim_log_logger_add(&txt_logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
196 gaim_log_logger_add(&old_logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
197 gaim_prefs_connect_callback("/core/logging/format",
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
198 logger_pref_cb, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
199 gaim_prefs_trigger_callback("/core/logging/format");
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
200 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
201
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
202 /****************************************************************************
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
203 * LOGGERS ******************************************************************
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
204 ****************************************************************************/
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
205
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
206 static GList *log_lister_common(const char *screenname, GaimAccount *account, const char *ext, GaimLogLogger *logger)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
207 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
208 GDir *dir;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
209 GList *list = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
210 const char *filename;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
211 char *me = g_strdup(gaim_normalize(account, gaim_account_get_username(account)));
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
213 const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
214 (gaim_find_prpl(gaim_account_get_protocol(account)))->list_icon(account, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
215 char *path = g_build_filename(gaim_user_dir(), "logs", prpl, me, gaim_normalize(account, screenname), NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
216
7447
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7443
diff changeset
217 g_free(me);
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7443
diff changeset
218
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
219 if (!(dir = g_dir_open(path, 0, NULL))) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
220 g_free(path);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
221 return NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
222 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
223 while ((filename = g_dir_read_name(dir))) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
224 if (g_str_has_suffix(filename, ext)) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
225 const char *l = filename;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
226 struct tm time;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
227 GaimLog *log;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
228 char d[5];
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
229
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
230 strncpy(d, l, 4);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
231 d[4] = '\0';
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
232 time.tm_year = atoi(d) - 1900;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
233 l = l + 5;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
234
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
235 strncpy(d, l, 2);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
236 d[2] = '\0';
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
237 time.tm_mon = atoi(d) - 1;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
238 l = l + 3;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
239
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
240 strncpy(d, l, 2);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
241 time.tm_mday = atoi(d);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
242 l = l + 3;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
243
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
244 strncpy(d, l, 2);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
245 time.tm_hour = atoi(d);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
246 l = l + 2;
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
247
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
248 strncpy(d, l, 2);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
249 time.tm_min = atoi(d);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
250 l = l + 2;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
251
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
252 strncpy(d, l, 2);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
253 time.tm_sec = atoi(d);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
254 l = l + 2;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
255 log = gaim_log_new(GAIM_LOG_IM, screenname, account, mktime(&time));
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
256 log->logger = logger;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
257 log->logger_data = g_build_filename(path, filename, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
258 list = g_list_append(list, log);
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 }
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 }
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
261 g_dir_close(dir);
7447
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7443
diff changeset
262 g_free(path);
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
263 return list;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
264 }
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
266 #if 0 /* Maybe some other time. */
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
267 /****************
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
268 ** XML LOGGER **
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
269 ****************/
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
270
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
271 static const char *str_from_msg_type (GaimMessageFlags type)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
272 {
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
273
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
274 return "";
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
275
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
276 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
277
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
278 static void xml_logger_write(GaimLog *log,
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
279 GaimMessageFlags type,
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
280 const char *from, time_t time, const char *message)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
281 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
282 char date[64];
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
283 char *xhtml = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
284 if (!log->logger_data) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
285 /* This log is new. We could use the loggers 'new' function, but
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
286 * creating a new file there would result in empty files in the case
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
287 * that you open a convo with someone, but don't say anything.
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
288 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
289 char *ud = gaim_user_dir();
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
290 char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account)));
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
291 const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
292 (gaim_find_prpl(gaim_account_get_protocol(log->account)))->list_icon(log->account, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
293 char *dir;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
294 FILE *file;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
295
7453
6f5918e4f668 [gaim-migrate @ 8066]
Nathan Walp <nwalp@pidgin.im>
parents: 7447
diff changeset
296 strftime(date, sizeof(date), "%Y-%m-%d.%H%M%S.xml", localtime(&log->time));
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
297
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
298 dir = g_build_filename(ud, "logs", NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
299 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
300 g_free(dir);
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
301 dir = g_build_filename(ud, "logs",
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
302 prpl, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
303 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
304 g_free(dir);
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
305 dir = g_build_filename(ud, "logs",
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
306 prpl, guy, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
307 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
308 g_free(dir);
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
309 dir = g_build_filename(ud, "logs",
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
310 prpl, guy, gaim_normalize(log->account, log->name), NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
311 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
7447
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7443
diff changeset
312 g_free(guy);
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
313
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
314 char *filename = g_build_filename(dir, date, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
315 g_free(dir);
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
316
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
317 file = fopen(dir, "r");
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
318 if(!file)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
319 mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
320 else
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
321 fclose(file);
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
322
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
323 log->logger_data = fopen(filename, "a");
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
324 if (!log->logger_data) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
325 gaim_debug(GAIM_DEBUG_ERROR, "log", "Could not create log file %s\n", filename);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
326 return;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
327 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
328 fprintf(log->logger_data, "<?xml version='1.0' encoding='UTF-8' ?>\n"
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
329 "<?xml-stylesheet href='file:///usr/src/web/htdocs/log-stylesheet.xsl' type='text/xml' ?>\n");
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
330
7453
6f5918e4f668 [gaim-migrate @ 8066]
Nathan Walp <nwalp@pidgin.im>
parents: 7447
diff changeset
331 strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&log->time));
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
332 fprintf(log->logger_data, "<conversation time='%s' screenname='%s' protocol='%s'>\n",
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
333 date, log->name, prpl);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
334 }
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
335
7453
6f5918e4f668 [gaim-migrate @ 8066]
Nathan Walp <nwalp@pidgin.im>
parents: 7447
diff changeset
336 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time));
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
337 gaim_markup_html_to_xhtml(message, &xhtml, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
338 if (from)
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
339 fprintf(log->logger_data, "<message %s %s from='%s' time='%s'>%s</message>\n",
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
340 str_from_msg_type(type),
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
341 type & GAIM_MESSAGE_SEND ? "direction='sent'" :
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
342 type & GAIM_MESSAGE_RECV ? "direction='received'" : "",
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
343 from, date, xhtml);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
344 else
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
345 fprintf(log->logger_data, "<message %s %s time='%s'>%s</message>\n",
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
346 str_from_msg_type(type),
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
347 type & GAIM_MESSAGE_SEND ? "direction='sent'" :
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
348 type & GAIM_MESSAGE_RECV ? "direction='received'" : "",
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
349 date, xhtml):
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
350 fflush(log->logger_data);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
351 g_free(xhtml);
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
352 }
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
353
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
354 static void xml_logger_finalize(GaimLog *log)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
355 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
356 if (log->logger_data) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
357 fprintf(log->logger_data, "</conversation>\n");
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
358 fclose(log->logger_data);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
359 log->logger_data = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
360 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
361 }
7443
df50bd14e161 [gaim-migrate @ 8048]
Luke Schierer <lschiere@pidgin.im>
parents: 7442
diff changeset
362
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
363 static GList *xml_logger_list(const char *sn, GaimAccount *account)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
364 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
365 return log_lister_common(sn, account, ".xml", &xml_logger);
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366 }
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
367
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
368 static GaimLogLogger xml_logger = {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
369 N_("XML"), "xml",
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
370 NULL,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
371 xml_logger_write,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
372 xml_logger_finalize,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
373 xml_logger_list,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
374 NULL
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
375 };
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
376 #endif
5563
9eb5b13fd412 [gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents: 5560
diff changeset
377
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
378 /****************************
7457
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
379 ** HTML LOGGER *************
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
380 ****************************/
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
381
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
382 static void html_logger_write(GaimLog *log, GaimMessageFlags type,
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
383 const char *from, time_t time, const char *message)
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
384 {
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
385 char date[64];
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
386 if(!log->logger_data) {
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
387 /* This log is new */
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
388 char *ud = gaim_user_dir();
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
389 char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account)));
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
390 const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
391 (gaim_find_prpl(gaim_account_get_protocol(log->account)))->list_icon(log->account, NULL);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
392 char *dir;
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
393 char *filename;
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
394 FILE *file;
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
395
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
396 strftime(date, sizeof(date), "%Y-%m-%d.%H%M%S.html", localtime(&log->time));
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
397
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
398 dir = g_build_filename(ud, "logs", NULL);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
399 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
400 g_free(dir);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
401 dir = g_build_filename(ud, "logs",
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
402 prpl, NULL);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
403 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
404 g_free(dir);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
405 dir = g_build_filename(ud, "logs",
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
406 prpl, guy, NULL);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
407 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
408 g_free(dir);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
409 dir = g_build_filename(ud, "logs",
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
410 prpl, guy, gaim_normalize(log->account, log->name), NULL);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
411 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
412 g_free(guy);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
413
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
414 filename = g_build_filename(dir, date, NULL);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
415 g_free(dir);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
416
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
417 file = fopen(dir, "r");
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
418 if(!file)
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
419 mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
420 else
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
421 fclose(file);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
422
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
423 log->logger_data = fopen(filename, "a");
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
424 if (!log->logger_data) {
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
425 gaim_debug(GAIM_DEBUG_ERROR, "log", "Could not create log file %s\n", filename);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
426 return;
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
427 }
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
428 g_free(filename);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
429 strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&log->time));
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
430 fprintf(log->logger_data, "<html><head><title>");
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
431 fprintf(log->logger_data, "Conversation with %s at %s on %s (%s)",
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
432 log->name, date, gaim_account_get_username(log->account), prpl);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
433 fprintf(log->logger_data, "</title></head><body>");
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
434 fprintf(log->logger_data,
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
435 "<h3>Conversation with %s at %s on %s (%s)</h3>\n",
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
436 log->name, date, gaim_account_get_username(log->account), prpl);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
437 }
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
438 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time));
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
439 fprintf(log->logger_data, "(%s) %s%s %s<br/>\n", date, from ? from : "", from ? ":" : "", message);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
440 fflush(log->logger_data);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
441 }
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
442
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
443 static void html_logger_finalize(GaimLog *log)
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
444 {
7463
f2d82df37252 [gaim-migrate @ 8076]
Nathan Walp <nwalp@pidgin.im>
parents: 7462
diff changeset
445 if (log->logger_data) {
f2d82df37252 [gaim-migrate @ 8076]
Nathan Walp <nwalp@pidgin.im>
parents: 7462
diff changeset
446 fprintf(log->logger_data, "</body></html>");
7457
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
447 fclose(log->logger_data);
7463
f2d82df37252 [gaim-migrate @ 8076]
Nathan Walp <nwalp@pidgin.im>
parents: 7462
diff changeset
448 }
7457
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
449 }
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
450
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
451 static GList *html_logger_list(const char *sn, GaimAccount *account)
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
452 {
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
453 return log_lister_common(sn, account, ".html", &html_logger);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
454 }
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
455
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
456 static char *html_logger_read(GaimLog *log, GaimLogReadFlags *flags)
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
457 {
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
458 char *read, *minus_header;
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
459 *flags = GAIM_LOG_READ_NO_NEWLINE;
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
460 if (!log->logger_data)
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
461 return g_strdup("<font color='red'><b>log->logger_data was NULL!</b></font>");
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
462 if (g_file_get_contents((char *)log->logger_data, &read, NULL, NULL)) {
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
463 minus_header = strchr(read, '\n');
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
464 if (!minus_header)
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
465 minus_header = g_strdup(read);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
466 else
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
467 minus_header = g_strdup(minus_header + 1);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
468 g_free(read);
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
469 return minus_header;
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
470 }
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
471 return g_strdup(_("<font color='red'><b>Could not read file: %s</b></font>"));
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
472 }
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
473
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
474 static GaimLogLogger html_logger = {
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
475 N_("HTML"), "html",
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
476 NULL,
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
477 html_logger_write,
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
478 html_logger_finalize,
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
479 html_logger_list,
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
480 html_logger_read
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
481 };
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
482
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
483
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
484
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
485
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
486 /****************************
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
487 ** PLAIN TEXT LOGGER *******
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
488 ****************************/
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
489
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
490 static void txt_logger_write(GaimLog *log,
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
491 GaimMessageFlags type,
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
492 const char *from, time_t time, const char *message)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
493 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
494 char date[64];
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
495 char *stripped = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
496 if (!log->logger_data) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
497 /* This log is new. We could use the loggers 'new' function, but
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
498 * creating a new file there would result in empty files in the case
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
499 * that you open a convo with someone, but don't say anything.
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
500 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
501 char *ud = gaim_user_dir();
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
502 char *guy = g_strdup(gaim_normalize(log->account, gaim_account_get_username(log->account)));
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
503 const char *prpl = GAIM_PLUGIN_PROTOCOL_INFO
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
504 (gaim_find_prpl(gaim_account_get_protocol(log->account)))->list_icon(log->account, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
505 char *dir;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
506 FILE *file;
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
507
7453
6f5918e4f668 [gaim-migrate @ 8066]
Nathan Walp <nwalp@pidgin.im>
parents: 7447
diff changeset
508 strftime(date, sizeof(date), "%Y-%m-%d.%H%M%S.txt", localtime(&log->time));
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
509
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
510 dir = g_build_filename(ud, "logs", NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
511 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
512 g_free(dir);
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
513 dir = g_build_filename(ud, "logs",
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
514 prpl, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
515 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
516 g_free(dir);
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
517 dir = g_build_filename(ud, "logs",
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
518 prpl, guy, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
519 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
520 g_free(dir);
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
521 dir = g_build_filename(ud, "logs",
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
522 prpl, guy, gaim_normalize(log->account, log->name), NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
523 mkdir (dir, S_IRUSR | S_IWUSR | S_IXUSR);
7447
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7443
diff changeset
524 g_free(guy);
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
525
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
526 char *filename = g_build_filename(dir, date, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
527 g_free(dir);
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
528
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
529 file = fopen(dir, "r");
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
530 if(!file)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
531 mkdir(dir, S_IRUSR | S_IWUSR | S_IXUSR);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
532 else
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
533 fclose(file);
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
534
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
535 log->logger_data = fopen(filename, "a");
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
536 if (!log->logger_data) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
537 gaim_debug(GAIM_DEBUG_ERROR, "log", "Could not create log file %s\n", filename);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
538 return;
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
539 }
7447
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7443
diff changeset
540 g_free(filename);
7453
6f5918e4f668 [gaim-migrate @ 8066]
Nathan Walp <nwalp@pidgin.im>
parents: 7447
diff changeset
541 strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&log->time));
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
542 fprintf(log->logger_data, "Conversation with %s at %s on %s (%s)\n",
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
543 log->name, date, gaim_account_get_username(log->account), prpl);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
544 }
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
545
7453
6f5918e4f668 [gaim-migrate @ 8066]
Nathan Walp <nwalp@pidgin.im>
parents: 7447
diff changeset
546 strftime(date, sizeof(date), "%H:%M:%S", localtime(&time));
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
547 stripped = gaim_markup_strip_html(message);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
548 fprintf(log->logger_data, "(%s) %s%s %s\n", date, from ? from : "", from ? ":" : "", stripped);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
549 fflush(log->logger_data);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
550 g_free(stripped);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
551 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
552
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
553 static void txt_logger_finalize(GaimLog *log)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
554 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
555 if (log->logger_data)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
556 fclose(log->logger_data);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
557 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
558
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
559 static GList *txt_logger_list(const char *sn, GaimAccount *account)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
560 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
561 return log_lister_common(sn, account, ".txt", &txt_logger);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
562 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
563
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
564 static char *txt_logger_read(GaimLog *log, GaimLogReadFlags *flags)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
565 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
566 char *read, *minus_header;
7457
8bc33ec515a1 [gaim-migrate @ 8070]
Nathan Walp <nwalp@pidgin.im>
parents: 7453
diff changeset
567 *flags = 0;
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
568 if (!log->logger_data)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
569 return g_strdup("<font color='red'><b>log->logger_data was NULL!</b></font>");
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
570 if (g_file_get_contents((char *)log->logger_data, &read, NULL, NULL)) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
571 minus_header = strchr(read, '\n');
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
572 if (!minus_header)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
573 minus_header = g_strdup(read);
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
574 else
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
575 minus_header = g_strdup(minus_header + 1);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
576 g_free(read);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
577 return minus_header;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
578 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
579 return g_strdup(_("<font color='red'><b>Could not read file: %s</b></font>"));
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
580 }
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
581
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
582 static GaimLogLogger txt_logger = {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
583 N_("Plain text"), "txt",
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
584 NULL,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
585 txt_logger_write,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
586 txt_logger_finalize,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
587 txt_logger_list,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
588 txt_logger_read
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
589 };
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
590
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
591 /****************
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
592 * OLD LOGGER ***
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
593 ****************/
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
594
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
595 /* The old logger doesn't write logs, only reads them. This is to include
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
596 * old logs in the log viewer transparently.
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
597 */
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
598
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
599 struct old_logger_data {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
600 char *path;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
601 int offset;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
602 int length;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
603 };
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
604
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
605 static GList *old_logger_list(const char *sn, GaimAccount *account)
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
606 {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
607 FILE *file;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
608 char buf[BUF_LONG];
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
609 struct tm tm;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
610 struct old_logger_data *data = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
611 char day[4], month[4], year[5];
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
612 char *logfile = g_strdup_printf("%s.log", gaim_normalize(account, sn));
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
613 char *date;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
614 char *path = g_build_filename(gaim_user_dir(), "logs", logfile, NULL);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
615 char *newlog;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
616
7447
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7443
diff changeset
617 g_free(logfile);
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7443
diff changeset
618
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
619 GaimLog *log = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
620 GList *list = NULL;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
621
7461
c1ddc403fda4 [gaim-migrate @ 8074]
Nathan Walp <nwalp@pidgin.im>
parents: 7457
diff changeset
622 if (!(file = fopen(path, "rb"))) {
7447
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7443
diff changeset
623 g_free(path);
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
624 return NULL;
7447
0e7a835e2433 [gaim-migrate @ 8058]
Mark Doliner <mark@kingant.net>
parents: 7443
diff changeset
625 }
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
626
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
627 while (fgets(buf, BUF_LONG, file)) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
628 if ((newlog = strstr(buf, "---- New C"))) {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
629 int length;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
630 int offset;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
631 GDate gdate;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
632 char convostart[32];
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
633 char *temp = strchr(buf, '@');
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
634
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
635 if (temp == NULL || strlen(temp) < 2)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
636 continue;
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
637
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
638 temp++;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
639 length = strcspn(temp, "-");
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
640 if (length > 31) length = 31;
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
641
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
642 offset = ftell(file);
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
643
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
644 if (data) {
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
645 data->length = offset - data->offset - length;
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
646 if(strstr(buf, "----</H3><BR>")) {
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
647 data->length -=
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
648 strlen("<HR><BR><H3 Align=Center> ---- New Conversation @ ") +
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
649 strlen("----</H3><BR>");
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
650 } else {
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
651 data->length -=
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
652 strlen("---- New Conversation @ ") + strlen("----");
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
653 }
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
654
7461
c1ddc403fda4 [gaim-migrate @ 8074]
Nathan Walp <nwalp@pidgin.im>
parents: 7457
diff changeset
655 if(strchr(buf, '\r'))
c1ddc403fda4 [gaim-migrate @ 8074]
Nathan Walp <nwalp@pidgin.im>
parents: 7457
diff changeset
656 data->length--;
c1ddc403fda4 [gaim-migrate @ 8074]
Nathan Walp <nwalp@pidgin.im>
parents: 7457
diff changeset
657
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
658 if (data->length != 0)
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
659 list = g_list_append(list, log);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
660 else
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
661 gaim_log_free(log);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
662 }
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
663
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
664 log = gaim_log_new(GAIM_LOG_IM, sn, account, -1);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
665 log->logger = &old_logger;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
666
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
667 data = g_new0(struct old_logger_data, 1);
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
668 data->offset = offset;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
669 data->path = path;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
670 log->logger_data = data;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
671
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
672
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
673 g_snprintf(convostart, length, "%s", temp);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
674 sscanf(convostart, "%*s %s %s %d:%d:%d %s",
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
675 month, day, &tm.tm_hour, &tm.tm_min, &tm.tm_sec, year);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
676 date = g_strdup_printf("%s %s %s", month, day, year);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
677 g_date_set_parse(&gdate, date);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
678 tm.tm_mday = g_date_get_day(&gdate);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
679 tm.tm_mon = g_date_get_month(&gdate) - 1;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
680 tm.tm_year = g_date_get_year(&gdate) - 1900;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
681 log->time = mktime(&tm);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
682
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
683 }
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
684 }
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
685 fclose(file);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
686 return list;
4184
af2eeb7f7cf8 [gaim-migrate @ 4415]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
687 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4227
diff changeset
688
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
689 char * old_logger_read (GaimLog *log, GaimLogReadFlags *flags)
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4227
diff changeset
690 {
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
691 struct old_logger_data *data = log->logger_data;
7461
c1ddc403fda4 [gaim-migrate @ 8074]
Nathan Walp <nwalp@pidgin.im>
parents: 7457
diff changeset
692 FILE *file = fopen(data->path, "rb");
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
693 char *read = g_malloc(data->length + 1);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
694 fseek(file, data->offset, SEEK_SET);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
695 fread(read, data->length, 1, file);
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
696 read[data->length] = '\0';
7436
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
697 *flags = 0;
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
698 if(strstr(read, "<BR>"))
7cdbd2eb7546 [gaim-migrate @ 8041]
Nathan Walp <nwalp@pidgin.im>
parents: 7431
diff changeset
699 *flags |= GAIM_LOG_READ_NO_NEWLINE;
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
700 return read;
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
701 }
4359
5fb47ec9bfe4 [gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents: 4227
diff changeset
702
7431
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
703 static GaimLogLogger old_logger = {
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
704 "old logger", "old",
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
705 NULL, NULL, NULL,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
706 old_logger_list,
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
707 old_logger_read
643cbc9a6035 [gaim-migrate @ 8036]
Sean Egan <seanegan@gmail.com>
parents: 7322
diff changeset
708 };