Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 354 lines (307 sloc) 10.368 kB
7d4fbcd Initial check in
James M. Kretchmar authored
1 #include "owl.h"
2 #include <stdlib.h>
3 #include <string.h>
4 #include <ctype.h>
5 #include <sys/param.h>
6
15b34fd Fixed some small memory leaks in logging if files unwriteable
James M. Kretchmar authored
7 /* This is now the one function that should be called to log a
8 * message. It will do all the work necessary by calling the other
9 * functions in this file as necessary.
10 */
c08c70a @andersk Add const qualifiers for owl_message *.
andersk authored
11 void owl_log_message(const owl_message *m) {
15b34fd Fixed some small memory leaks in logging if files unwriteable
James M. Kretchmar authored
12 owl_function_debugmsg("owl_log_message: entering");
13
3c7d086 Fix for BZ 90:
Erik Nygren authored
14 if (m == NULL) {
15 owl_function_debugmsg("owl_log_message: passed null message");
16 return;
17 }
18
15b34fd Fixed some small memory leaks in logging if files unwriteable
James M. Kretchmar authored
19 /* should we be logging this message? */
20 if (!owl_log_shouldlog_message(m)) {
21 owl_function_debugmsg("owl_log_message: not logging message");
22 return;
23 }
24
25 /* handle incmoing messages */
26 if (owl_message_is_direction_in(m)) {
27 owl_log_incoming(m);
28 owl_function_debugmsg("owl_log_message: leaving");
29 return;
30 }
31
32 /* handle outgoing messages */
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
33 owl_log_outgoing(m);
34
15b34fd Fixed some small memory leaks in logging if files unwriteable
James M. Kretchmar authored
35 owl_function_debugmsg("owl_log_message: leaving");
36 }
7d4fbcd Initial check in
James M. Kretchmar authored
37
15b34fd Fixed some small memory leaks in logging if files unwriteable
James M. Kretchmar authored
38 /* Return 1 if we should log the given message, otherwise return 0 */
c08c70a @andersk Add const qualifiers for owl_message *.
andersk authored
39 int owl_log_shouldlog_message(const owl_message *m) {
4542047 @andersk Add const qualifiers for owl_filter *.
andersk authored
40 const owl_filter *f;
12c35df Fixed replies to loopback messages
James M. Kretchmar authored
41
15b34fd Fixed some small memory leaks in logging if files unwriteable
James M. Kretchmar authored
42 /* If there's a logfilter and this message matches it, log */
43 f=owl_global_get_filter(&g, owl_global_get_logfilter(&g));
44 if (f && owl_filter_message_match(f, m)) return(1);
7d4fbcd Initial check in
James M. Kretchmar authored
45
15b34fd Fixed some small memory leaks in logging if files unwriteable
James M. Kretchmar authored
46 /* otherwise we do things based on the logging variables */
47
48 /* skip login/logout messages if appropriate */
49 if (!owl_global_is_loglogins(&g) && owl_message_is_loginout(m)) return(0);
50
51 /* check direction */
52 if ((owl_global_get_loggingdirection(&g)==OWL_LOGGING_DIRECTION_IN) && owl_message_is_direction_out(m)) {
53 return(0);
54 }
55 if ((owl_global_get_loggingdirection(&g)==OWL_LOGGING_DIRECTION_OUT) && owl_message_is_direction_in(m)) {
56 return(0);
57 }
58
59 if (owl_message_is_type_zephyr(m)) {
60 if (owl_message_is_personal(m) && !owl_global_is_logging(&g)) return(0);
61 if (!owl_message_is_personal(m) && !owl_global_is_classlogging(&g)) return(0);
62 } else {
63 if (owl_message_is_private(m) || owl_message_is_loginout(m)) {
64 if (!owl_global_is_logging(&g)) return(0);
65 } else {
66 if (!owl_global_is_classlogging(&g)) return(0);
67 }
7d4fbcd Initial check in
James M. Kretchmar authored
68 }
15b34fd Fixed some small memory leaks in logging if files unwriteable
James M. Kretchmar authored
69 return(1);
70 }
71
c08c70a @andersk Add const qualifiers for owl_message *.
andersk authored
72 void owl_log_zephyr(const owl_message *m, FILE *file) {
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
73 char *tmp;
74 tmp=short_zuser(owl_message_get_sender(m));
75 fprintf(file, "Class: %s Instance: %s", owl_message_get_class(m), owl_message_get_instance(m));
76 if (strcmp(owl_message_get_opcode(m), "")) fprintf(file, " Opcode: %s", owl_message_get_opcode(m));
77 fprintf(file, "\n");
78 fprintf(file, "Time: %s Host: %s\n", owl_message_get_timestr(m), owl_message_get_hostname(m));
79 fprintf(file, "From: %s <%s>\n\n", owl_message_get_zsig(m), tmp);
80 fprintf(file, "%s\n\n", owl_message_get_body(m));
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
81 g_free(tmp);
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
82 }
83
c08c70a @andersk Add const qualifiers for owl_message *.
andersk authored
84 void owl_log_aim(const owl_message *m, FILE *file) {
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
85 fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m));
86 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
87 if (owl_message_is_login(m))
88 fprintf(file, "LOGIN\n\n");
89 else if (owl_message_is_logout(m))
90 fprintf(file, "LOGOUT\n\n");
91 else
92 fprintf(file, "%s\n\n", owl_message_get_body(m));
93 }
94
c08c70a @andersk Add const qualifiers for owl_message *.
andersk authored
95 void owl_log_jabber(const owl_message *m, FILE *file) {
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
96 fprintf(file, "From: <%s> To: <%s>\n",owl_message_get_sender(m), owl_message_get_recipient(m));
97 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
98 fprintf(file, "%s\n\n",owl_message_get_body(m));
99 }
100
c08c70a @andersk Add const qualifiers for owl_message *.
andersk authored
101 void owl_log_generic(const owl_message *m, FILE *file) {
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
102 fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m));
103 fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
104 fprintf(file, "%s\n\n", owl_message_get_body(m));
105 }
106
c08c70a @andersk Add const qualifiers for owl_message *.
andersk authored
107 void owl_log_append(const owl_message *m, const char *filename) {
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
108 FILE *file;
109 file=fopen(filename, "a");
110 if (!file) {
111 owl_function_error("Unable to open file for logging");
112 return;
113 }
114 if (owl_message_is_type_zephyr(m)) {
115 owl_log_zephyr(m, file);
116 } else if (owl_message_is_type_jabber(m)) {
117 owl_log_jabber(m, file);
118 } else if (owl_message_is_type_aim(m)) {
119 owl_log_aim(m, file);
120 } else {
121 owl_log_generic(m, file);
122 }
123 fclose(file);
124 }
125
c08c70a @andersk Add const qualifiers for owl_message *.
andersk authored
126 void owl_log_outgoing(const owl_message *m)
15b34fd Fixed some small memory leaks in logging if files unwriteable
James M. Kretchmar authored
127 {
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
128 char *filename, *logpath;
9c590d4 @alexmv Outgoing CC'd messages get logged to all recipients
alexmv authored
129 char *to, *temp;
839697d @nelhage Make owl_message_get_cc_without_recipient return a GList.
nelhage authored
130 GList *cc;
9c590d4 @alexmv Outgoing CC'd messages get logged to all recipients
alexmv authored
131
132 /* expand ~ in path names */
60d7935 @andersk Use owl_util_makepath instead of faking ~ expansion by owl_text_subst…
andersk authored
133 logpath = owl_util_makepath(owl_global_get_logpath(&g));
15b34fd Fixed some small memory leaks in logging if files unwriteable
James M. Kretchmar authored
134
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
135 /* Figure out what path to log to */
136 if (owl_message_is_type_zephyr(m)) {
af1920f @asedeno Portability - removing C++ style comments.
authored
137 /* If this has CC's, do all but the "recipient" which we'll do below */
839697d @nelhage Make owl_message_get_cc_without_recipient return a GList.
nelhage authored
138 cc = owl_message_get_cc_without_recipient(m);
139 while (cc != NULL) {
140 temp = short_zuser(cc->data);
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
141 filename = g_strdup_printf("%s/%s", logpath, temp);
839697d @nelhage Make owl_message_get_cc_without_recipient return a GList.
nelhage authored
142 owl_log_append(m, filename);
143
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
144 g_free(filename);
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
145 g_free(temp);
146 g_free(cc->data);
839697d @nelhage Make owl_message_get_cc_without_recipient return a GList.
nelhage authored
147 cc = g_list_delete_link(cc, cc);
9c590d4 @alexmv Outgoing CC'd messages get logged to all recipients
alexmv authored
148 }
839697d @nelhage Make owl_message_get_cc_without_recipient return a GList.
nelhage authored
149
9c590d4 @alexmv Outgoing CC'd messages get logged to all recipients
alexmv authored
150 to = short_zuser(owl_message_get_recipient(m));
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
151 } else if (owl_message_is_type_jabber(m)) {
3472845 @andersk Replace owl_sprintf with g_strdup_printf.
andersk authored
152 to = g_strdup_printf("jabber:%s", owl_message_get_recipient(m));
d8671a1 @nelhage logging.c: Replace / with _ in JIDs when logging Jabber
nelhage authored
153 owl_text_tr(to, '/', '_');
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
154 } else if (owl_message_is_type_aim(m)) {
28ee32b @asedeno UTF-8 - first pass
authored
155 char *temp2;
9c590d4 @alexmv Outgoing CC'd messages get logged to all recipients
alexmv authored
156 temp = owl_aim_normalize_screenname(owl_message_get_recipient(m));
28ee32b @asedeno UTF-8 - first pass
authored
157 temp2 = g_utf8_strdown(temp,-1);
3472845 @andersk Replace owl_sprintf with g_strdup_printf.
andersk authored
158 to = g_strdup_printf("aim:%s", temp2);
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
159 g_free(temp2);
160 g_free(temp);
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
161 } else {
d4927a7 @andersk Replace owl_strdup with g_strdup.
andersk authored
162 to = g_strdup("loopback");
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
163 }
7d4fbcd Initial check in
James M. Kretchmar authored
164
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
165 filename = g_strdup_printf("%s/%s", logpath, to);
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
166 owl_log_append(m, filename);
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
167 g_free(to);
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
168 g_free(filename);
7d4fbcd Initial check in
James M. Kretchmar authored
169
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
170 filename = g_strdup_printf("%s/all", logpath);
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
171 owl_log_append(m, filename);
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
172 g_free(logpath);
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
173 g_free(filename);
7d4fbcd Initial check in
James M. Kretchmar authored
174 }
175
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
176
24ccc01 @nelhage Replace owl_message_create_from_zwriteline with owl_message_create_fr…
nelhage authored
177 void owl_log_outgoing_zephyr_error(const owl_zwrite *zw, const char *text)
2b86d14 Log when outgoing personal message fails
James M. Kretchmar authored
178 {
179 FILE *file;
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
180 char *filename, *logpath;
e2ebf39 @andersk owl_log_outgoing_zephyr_error: Remove unused variable zwriteline.
andersk authored
181 char *tobuff;
180cd15 Now deals with the special case of logging failed zwrites correctly
James M. Kretchmar authored
182 owl_message *m;
183
184 /* create a present message so we can pass it to
c79a047 @andersk Correctly prototype functions with no parameters as foo(void), not fo…
andersk authored
185 * owl_log_shouldlog_message(void)
180cd15 Now deals with the special case of logging failed zwrites correctly
James M. Kretchmar authored
186 */
96828e4 @andersk Replace owl_malloc with g_new and g_new0.
andersk authored
187 m = g_new(owl_message, 1);
24ccc01 @nelhage Replace owl_message_create_from_zwriteline with owl_message_create_fr…
nelhage authored
188 owl_message_create_from_zwrite(m, zw, text);
180cd15 Now deals with the special case of logging failed zwrites correctly
James M. Kretchmar authored
189 if (!owl_log_shouldlog_message(m)) {
91634ec @andersk Add owl_message_delete to fix leaks.
andersk authored
190 owl_message_delete(m);
180cd15 Now deals with the special case of logging failed zwrites correctly
James M. Kretchmar authored
191 return;
192 }
91634ec @andersk Add owl_message_delete to fix leaks.
andersk authored
193 owl_message_delete(m);
2b86d14 Log when outgoing personal message fails
James M. Kretchmar authored
194
180cd15 Now deals with the special case of logging failed zwrites correctly
James M. Kretchmar authored
195 /* chop off a local realm */
24ccc01 @nelhage Replace owl_message_create_from_zwriteline with owl_message_create_fr…
nelhage authored
196 tobuff = short_zuser(owl_list_get_element(&(zw->recips), 0));
2b86d14 Log when outgoing personal message fails
James M. Kretchmar authored
197
198 /* expand ~ in path names */
60d7935 @andersk Use owl_util_makepath instead of faking ~ expansion by owl_text_subst…
andersk authored
199 logpath = owl_util_makepath(owl_global_get_logpath(&g));
2b86d14 Log when outgoing personal message fails
James M. Kretchmar authored
200
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
201 filename = g_strdup_printf("%s/%s", logpath, tobuff);
2b86d14 Log when outgoing personal message fails
James M. Kretchmar authored
202 file=fopen(filename, "a");
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
203 g_free(filename);
2b86d14 Log when outgoing personal message fails
James M. Kretchmar authored
204 if (!file) {
205 owl_function_error("Unable to open file for outgoing logging");
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
206 g_free(logpath);
207 g_free(tobuff);
2b86d14 Log when outgoing personal message fails
James M. Kretchmar authored
208 return;
209 }
210 fprintf(file, "ERROR (owl): %s\n%s\n", tobuff, text);
211 if (text[strlen(text)-1]!='\n') {
212 fprintf(file, "\n");
213 }
214 fclose(file);
215
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
216 filename = g_strdup_printf("%s/all", logpath);
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
217 g_free(logpath);
2b86d14 Log when outgoing personal message fails
James M. Kretchmar authored
218 file=fopen(filename, "a");
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
219 g_free(filename);
2b86d14 Log when outgoing personal message fails
James M. Kretchmar authored
220 if (!file) {
221 owl_function_error("Unable to open file for outgoing logging");
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
222 g_free(tobuff);
2b86d14 Log when outgoing personal message fails
James M. Kretchmar authored
223 return;
224 }
225 fprintf(file, "ERROR (owl): %s\n%s\n", tobuff, text);
226 if (text[strlen(text)-1]!='\n') {
227 fprintf(file, "\n");
228 }
229 fclose(file);
230
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
231 g_free(tobuff);
2b86d14 Log when outgoing personal message fails
James M. Kretchmar authored
232 }
233
c08c70a @andersk Add const qualifiers for owl_message *.
andersk authored
234 void owl_log_incoming(const owl_message *m)
15283bb Updated basic help
James M. Kretchmar authored
235 {
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
236 char *filename, *allfilename, *logpath;
e19eb97 @andersk Add const qualifiers for char * and void *.
andersk authored
237 const char *from=NULL;
65b2173 @andersk Split up declarations for adding const qualifiers for char * and void *.
andersk authored
238 char *frombuff=NULL;
7d4fbcd Initial check in
James M. Kretchmar authored
239 int len, ch, i, personal;
12c35df Fixed replies to loopback messages
James M. Kretchmar authored
240
15b34fd Fixed some small memory leaks in logging if files unwriteable
James M. Kretchmar authored
241 /* figure out if it's a "personal" message or not */
aac889a AIM logging (both in and out) now works
James M. Kretchmar authored
242 if (owl_message_is_type_zephyr(m)) {
243 if (owl_message_is_personal(m)) {
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
244 personal = 1;
aac889a AIM logging (both in and out) now works
James M. Kretchmar authored
245 } else {
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
246 personal = 0;
aac889a AIM logging (both in and out) now works
James M. Kretchmar authored
247 }
2182be3 Logging for jabber.
Arun A. Tharuvai authored
248 } else if (owl_message_is_type_jabber(m)) {
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
249 /* This needs to be fixed to handle groupchat */
e19eb97 @andersk Add const qualifiers for char * and void *.
andersk authored
250 const char* msgtype = owl_message_get_attribute_value(m,"jtype");
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
251 if (msgtype && !strcmp(msgtype,"groupchat")) {
252 personal = 0;
253 } else {
254 personal = 1;
255 }
7d4fbcd Initial check in
James M. Kretchmar authored
256 } else {
79a0e82 Fixed personal aim messages logging to class directory
James M. Kretchmar authored
257 if (owl_message_is_private(m) || owl_message_is_loginout(m)) {
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
258 personal = 1;
aac889a AIM logging (both in and out) now works
James M. Kretchmar authored
259 } else {
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
260 personal = 0;
aac889a AIM logging (both in and out) now works
James M. Kretchmar authored
261 }
7d4fbcd Initial check in
James M. Kretchmar authored
262 }
263
2182be3 Logging for jabber.
Arun A. Tharuvai authored
264
aac889a AIM logging (both in and out) now works
James M. Kretchmar authored
265 if (owl_message_is_type_zephyr(m)) {
266 if (personal) {
3066d23 @asedeno Fix outgoing jabber logging.
authored
267 from=frombuff=short_zuser(owl_message_get_sender(m));
aac889a AIM logging (both in and out) now works
James M. Kretchmar authored
268 } else {
d4927a7 @andersk Replace owl_strdup with g_strdup.
andersk authored
269 from=frombuff=g_strdup(owl_message_get_class(m));
7d4fbcd Initial check in
James M. Kretchmar authored
270 }
aac889a AIM logging (both in and out) now works
James M. Kretchmar authored
271 } else if (owl_message_is_type_aim(m)) {
272 /* we do not yet handle chat rooms */
28ee32b @asedeno UTF-8 - first pass
authored
273 char *normalto, *temp;
274 temp = owl_aim_normalize_screenname(owl_message_get_sender(m));
275 normalto = g_utf8_strdown(temp, -1);
3472845 @andersk Replace owl_sprintf with g_strdup_printf.
andersk authored
276 from=frombuff=g_strdup_printf("aim:%s", normalto);
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
277 g_free(normalto);
278 g_free(temp);
37eab7f Added the loopback message type
James M. Kretchmar authored
279 } else if (owl_message_is_type_loopback(m)) {
d4927a7 @andersk Replace owl_strdup with g_strdup.
andersk authored
280 from=frombuff=g_strdup("loopback");
2182be3 Logging for jabber.
Arun A. Tharuvai authored
281 } else if (owl_message_is_type_jabber(m)) {
5c30091 @hartmans * groupchat logged by recipient not by sender.
hartmans authored
282 if (personal) {
3472845 @andersk Replace owl_sprintf with g_strdup_printf.
andersk authored
283 from=frombuff=g_strdup_printf("jabber:%s",owl_message_get_sender(m));
5c30091 @hartmans * groupchat logged by recipient not by sender.
hartmans authored
284 } else {
3472845 @andersk Replace owl_sprintf with g_strdup_printf.
andersk authored
285 from=frombuff=g_strdup_printf("jabber:%s",owl_message_get_recipient(m));
5c30091 @hartmans * groupchat logged by recipient not by sender.
hartmans authored
286 }
e6449bc Owl should build now without zephyr, enabling it to act as a
James M. Kretchmar authored
287 } else {
d4927a7 @andersk Replace owl_strdup with g_strdup.
andersk authored
288 from=frombuff=g_strdup("unknown");
7d4fbcd Initial check in
James M. Kretchmar authored
289 }
290
291 /* check for malicious sender formats */
292 len=strlen(frombuff);
293 if (len<1 || len>35) from="weird";
294 if (strchr(frombuff, '/')) from="weird";
295
296 ch=frombuff[0];
28ee32b @asedeno UTF-8 - first pass
authored
297 if (!g_ascii_isalnum(ch)) from="weird";
7d4fbcd Initial check in
James M. Kretchmar authored
298
299 for (i=0; i<len; i++) {
e1c4636 * Added owl::send_zwrite(command, message) to the perl glue
Erik Nygren authored
300 if (frombuff[i]<'!' || frombuff[i]>='~') from="weird";
7d4fbcd Initial check in
James M. Kretchmar authored
301 }
302
303 if (!strcmp(frombuff, ".") || !strcasecmp(frombuff, "..")) from="weird";
304
305 if (!personal) {
28ee32b @asedeno UTF-8 - first pass
authored
306 if (strcmp(from, "weird")) {
307 char* temp = g_utf8_strdown(frombuff, -1);
308 if (temp) {
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
309 g_free(frombuff);
28ee32b @asedeno UTF-8 - first pass
authored
310 from = frombuff = temp;
311 }
312 }
7d4fbcd Initial check in
James M. Kretchmar authored
313 }
314
e1c4636 * Added owl::send_zwrite(command, message) to the perl glue
Erik Nygren authored
315 /* create the filename (expanding ~ in path names) */
7d4fbcd Initial check in
James M. Kretchmar authored
316 if (personal) {
60d7935 @andersk Use owl_util_makepath instead of faking ~ expansion by owl_text_subst…
andersk authored
317 logpath = owl_util_makepath(owl_global_get_logpath(&g));
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
318 filename = g_strdup_printf("%s/%s", logpath, from);
319 allfilename = g_strdup_printf("%s/all", logpath);
d0961fe @alexmv Incoming CC'd zephyrs logged to all people they were sent to
alexmv authored
320 owl_log_append(m, allfilename);
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
321 g_free(allfilename);
7d4fbcd Initial check in
James M. Kretchmar authored
322 } else {
60d7935 @andersk Use owl_util_makepath instead of faking ~ expansion by owl_text_subst…
andersk authored
323 logpath = owl_util_makepath(owl_global_get_classlogpath(&g));
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
324 filename = g_strdup_printf("%s/%s", logpath, from);
7d4fbcd Initial check in
James M. Kretchmar authored
325 }
37eab7f Added the loopback message type
James M. Kretchmar authored
326
42947f1 @alexmv * Outgoing messages now log as much information as incomign messages
alexmv authored
327 owl_log_append(m, filename);
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
328 g_free(filename);
7d4fbcd Initial check in
James M. Kretchmar authored
329
d0961fe @alexmv Incoming CC'd zephyrs logged to all people they were sent to
alexmv authored
330 if (personal && owl_message_is_type_zephyr(m)) {
af1920f @asedeno Portability - removing C++ style comments.
authored
331 /* We want to log to all of the CC'd people who were not us, or
332 * the sender, as well.
333 */
839697d @nelhage Make owl_message_get_cc_without_recipient return a GList.
nelhage authored
334 char *temp;
335 GList *cc;
d0961fe @alexmv Incoming CC'd zephyrs logged to all people they were sent to
alexmv authored
336 cc = owl_message_get_cc_without_recipient(m);
839697d @nelhage Make owl_message_get_cc_without_recipient return a GList.
nelhage authored
337 while (cc != NULL) {
338 temp = short_zuser(cc->data);
339 if (strcasecmp(temp, frombuff) != 0) {
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
340 filename = g_strdup_printf("%s/%s", logpath, temp);
839697d @nelhage Make owl_message_get_cc_without_recipient return a GList.
nelhage authored
341 owl_log_append(m, filename);
e3a75ed @davidben Replace the remaining snprintfs with g_strdup_printf
davidben authored
342 g_free(filename);
d0961fe @alexmv Incoming CC'd zephyrs logged to all people they were sent to
alexmv authored
343 }
839697d @nelhage Make owl_message_get_cc_without_recipient return a GList.
nelhage authored
344
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
345 g_free(temp);
346 g_free(cc->data);
839697d @nelhage Make owl_message_get_cc_without_recipient return a GList.
nelhage authored
347 cc = g_list_delete_link(cc, cc);
d0961fe @alexmv Incoming CC'd zephyrs logged to all people they were sent to
alexmv authored
348 }
349 }
7d4fbcd Initial check in
James M. Kretchmar authored
350
ddbbcff @andersk Replace owl_free with g_free.
andersk authored
351 g_free(frombuff);
352 g_free(logpath);
7d4fbcd Initial check in
James M. Kretchmar authored
353 }
Something went wrong with that request. Please try again.