annotate src/util.c @ 3747:adfae8eaacb1

[gaim-migrate @ 3885] the little i know about what needs done for i18n committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 18 Oct 2002 21:56:40 +0000
parents d85208a99af2
children 12b29552f1d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
1 /*
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
2 * gaim
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
3 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
5 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
9 * (at your option) any later version.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
10 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
14 * GNU General Public License for more details.
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
15 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
19 *
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
20 */
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
21
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 278
diff changeset
22 #ifdef HAVE_CONFIG_H
2090
b66aca8e8dce [gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2086
diff changeset
23 #include <config.h>
349
b402a23f35df [gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 278
diff changeset
24 #endif
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
25
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
26 #ifndef _WIN32
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
27 #include <unistd.h>
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
28 #include <sys/time.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
29 #include <sys/wait.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
30 #else
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
31 #include <direct.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
32 #include <io.h>
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
33 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
34
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
35 #include <errno.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
36 #include <stdio.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
37 #include <stdlib.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
38 #include <sys/types.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
39 #include <sys/stat.h>
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
40 #include <string.h>
210
ec0686b3b03f [gaim-migrate @ 220]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 209
diff changeset
41 #include <ctype.h>
3478
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
42 #ifdef HAVE_ICONV
3361
9bb2e904fadb [gaim-migrate @ 3380]
Sean Egan <seanegan@gmail.com>
parents: 3331
diff changeset
43 #include <iconv.h>
3478
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
44 #endif
1376
730a1a19b4cc [gaim-migrate @ 1386]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1293
diff changeset
45 #include <math.h>
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
46 #include "gaim.h"
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
47 #include "prpl.h"
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
48 #include "gtkspell.h"
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
49
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
50 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
51 #include "win32dep.h"
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
52 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
53
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
54 #ifndef MAXPATHLEN
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
55 #define MAXPATHLEN 1024
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
56 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
57
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
58 static char home_dir[MAXPATHLEN];
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
59
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
60 char *full_date()
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
61 {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
62 char *date;
70
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 26
diff changeset
63 time_t tme;
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 26
diff changeset
64
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 26
diff changeset
65 time(&tme);
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 26
diff changeset
66 date = ctime(&tme);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
67 date[strlen(date) - 1] = '\0';
70
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 26
diff changeset
68 return date;
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 26
diff changeset
69 }
dead1eb6d654 [gaim-migrate @ 80]
Rob Flynn <gaim@robflynn.com>
parents: 26
diff changeset
70
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
71 gint badchar(char c)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
72 {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
73 switch (c) {
970
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 967
diff changeset
74 case ' ':
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 967
diff changeset
75 case ',':
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 967
diff changeset
76 case '(':
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 967
diff changeset
77 case ')':
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 967
diff changeset
78 case '\0':
976
2586b2a3725e [gaim-migrate @ 986]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 970
diff changeset
79 case '\n':
970
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 967
diff changeset
80 case '<':
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 967
diff changeset
81 case '>':
1706
e6671b80a1f2 [gaim-migrate @ 1716]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1622
diff changeset
82 case '"':
413
7ea55575cc01 [gaim-migrate @ 423]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 373
diff changeset
83 return 1;
970
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 967
diff changeset
84 default:
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 967
diff changeset
85 return 0;
9eb07b383df4 [gaim-migrate @ 980]
Rob Flynn <gaim@robflynn.com>
parents: 967
diff changeset
86 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
87 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
88
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
89
1376
730a1a19b4cc [gaim-migrate @ 1386]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1293
diff changeset
90 gchar *sec_to_text(guint sec)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
91 {
1826
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
92 int daze, hrs, min;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
93 char *ret = g_malloc(256);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
94
1826
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
95 daze = sec / (60 * 60 * 24);
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
96 hrs = (sec % (60 * 60 * 24)) / (60 * 60);
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
97 min = (sec % (60 * 60)) / 60;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
98 sec = min % 60;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
99
1826
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
100 if (daze) {
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
101 if (hrs || min) {
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
102 if (hrs) {
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
103 if (min) {
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
104 g_snprintf(ret, 256,
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
105 "%d day%s, %d hour%s, %d minute%s.",
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
106 daze, daze == 1 ? "" : "s",
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
107 hrs, hrs == 1 ? "" : "s", min, min == 1 ? "" : "s");
1826
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
108 } else {
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
109 g_snprintf(ret, 256,
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
110 "%d day%s, %d hour%s.",
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
111 daze, daze == 1 ? "" : "s", hrs, hrs == 1 ? "" : "s");
1826
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
112 }
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
113 } else {
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
114 g_snprintf(ret, 256,
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
115 "%d day%s, %d minute%s.",
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
116 daze, daze == 1 ? "" : "s", min, min == 1 ? "" : "s");
1826
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
117 }
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
118 } else
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
119 g_snprintf(ret, 256, "%d day%s.", daze, daze == 1 ? "" : "s");
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
120 } else {
1826
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
121 if (hrs) {
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
122 if (min) {
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
123 g_snprintf(ret, 256,
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
124 "%d hour%s, %d minute%s.",
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
125 hrs, hrs == 1 ? "" : "s", min, min == 1 ? "" : "s");
1826
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
126 } else {
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
127 g_snprintf(ret, 256, "%d hour%s.", hrs, hrs == 1 ? "" : "s");
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
128 }
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
129 } else {
7f889cdfa03e [gaim-migrate @ 1836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1815
diff changeset
130 g_snprintf(ret, 256, "%d minute%s.", min, min == 1 ? "" : "s");
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
131 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
132 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
133
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
134 return ret;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
135 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
136
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
137 gint linkify_text(char *text)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
138 {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
139 char *c, *t;
1622
1acef460964a [gaim-migrate @ 1632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1609
diff changeset
140 char *cpy = g_malloc(strlen(text) * 3 + 1);
1acef460964a [gaim-migrate @ 1632]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1609
diff changeset
141 char url_buf[BUF_LEN * 4];
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
142 int cnt = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
143 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
144
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
145 strncpy(cpy, text, strlen(text));
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
146 cpy[strlen(text)] = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
147 c = cpy;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
148 while (*c) {
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2043
diff changeset
149 if (!g_strncasecmp(c, "<A", 2)) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
150 while (1) {
2596
35c23df11d16 [gaim-migrate @ 2609]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2397
diff changeset
151 if (!g_strncasecmp(c, "/A>", 3)) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
152 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
153 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
154 text[cnt++] = *c;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
155 c++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
156 if (!(*c))
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
157 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
158 }
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2043
diff changeset
159 } else if ((!g_strncasecmp(c, "http://", 7) || (!g_strncasecmp(c, "https://", 8)))) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
160 t = c;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
161 while (1) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
162 if (badchar(*t)) {
925
1ff824e6bc19 [gaim-migrate @ 935]
Rob Flynn <gaim@robflynn.com>
parents: 924
diff changeset
163
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
164 if (*(t) == ',' && (*(t + 1) != ' ')) {
925
1ff824e6bc19 [gaim-migrate @ 935]
Rob Flynn <gaim@robflynn.com>
parents: 924
diff changeset
165 t++;
1ff824e6bc19 [gaim-migrate @ 935]
Rob Flynn <gaim@robflynn.com>
parents: 924
diff changeset
166 continue;
1ff824e6bc19 [gaim-migrate @ 935]
Rob Flynn <gaim@robflynn.com>
parents: 924
diff changeset
167 }
1ff824e6bc19 [gaim-migrate @ 935]
Rob Flynn <gaim@robflynn.com>
parents: 924
diff changeset
168
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
169 if (*(t - 1) == '.')
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
170 t--;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
171 strncpy(url_buf, c, t - c);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
172 url_buf[t - c] = 0;
2614
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
173 cnt += g_snprintf(&text[cnt], 1024, "<A HREF=\"%s\">%s</A>",
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
174 url_buf, url_buf);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
175 c = t;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
176 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
177 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
178 if (!t)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
179 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
180 t++;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
181
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
182 }
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2043
diff changeset
183 } else if (!g_strncasecmp(c, "www.", 4)) {
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2043
diff changeset
184 if (g_strncasecmp(c, "www..", 5)) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
185 t = c;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
186 while (1) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
187 if (badchar(*t)) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
188 if (t - c == 4) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
189 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
190 }
925
1ff824e6bc19 [gaim-migrate @ 935]
Rob Flynn <gaim@robflynn.com>
parents: 924
diff changeset
191
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
192 if (*(t) == ',' && (*(t + 1) != ' ')) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
193 t++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
194 continue;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
195 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
196
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
197 if (*(t - 1) == '.')
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
198 t--;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
199 strncpy(url_buf, c, t - c);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
200 url_buf[t - c] = 0;
2614
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
201 cnt += g_snprintf(&text[cnt], 1024,
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
202 "<A HREF=\"http://%s\">%s</A>", url_buf,
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
203 url_buf);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
204 c = t;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
205 break;
925
1ff824e6bc19 [gaim-migrate @ 935]
Rob Flynn <gaim@robflynn.com>
parents: 924
diff changeset
206 }
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
207 if (!t)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
208 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
209 t++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
210 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
211 }
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2043
diff changeset
212 } else if (!g_strncasecmp(c, "ftp://", 6)) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
213 t = c;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
214 while (1) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
215 if (badchar(*t)) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
216 if (*(t - 1) == '.')
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
217 t--;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
218 strncpy(url_buf, c, t - c);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
219 url_buf[t - c] = 0;
2614
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
220 cnt += g_snprintf(&text[cnt], 1024, "<A HREF=\"%s\">%s</A>",
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
221 url_buf, url_buf);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
222 c = t;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
223 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
224 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
225 if (!t)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
226 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
227 t++;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
228
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
229 }
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2043
diff changeset
230 } else if (!g_strncasecmp(c, "ftp.", 4)) {
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2043
diff changeset
231 if (g_strncasecmp(c, "ftp..", 5)) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
232 t = c;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
233 while (1) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
234 if (badchar(*t)) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
235 if (t - c == 4) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
236 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
237 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
238 if (*(t - 1) == '.')
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
239 t--;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
240 strncpy(url_buf, c, t - c);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
241 url_buf[t - c] = 0;
2614
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
242 cnt += g_snprintf(&text[cnt], 1024,
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
243 "<A HREF=\"ftp://%s\">%s</A>", url_buf,
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
244 url_buf);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
245 c = t;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
246 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
247 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
248 if (!t)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
249 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
250 t++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
251 }
924
f6aa60716419 [gaim-migrate @ 934]
Rob Flynn <gaim@robflynn.com>
parents: 915
diff changeset
252 }
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2043
diff changeset
253 } else if (!g_strncasecmp(c, "mailto:", 7)) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
254 t = c;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
255 while (1) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
256 if (badchar(*t)) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
257 if (*(t - 1) == '.')
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
258 t--;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
259 strncpy(url_buf, c, t - c);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
260 url_buf[t - c] = 0;
2614
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
261 cnt += g_snprintf(&text[cnt], 1024, "<A HREF=\"%s\">%s</A>",
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
262 url_buf, url_buf);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
263 c = t;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
264 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
265 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
266 if (!t)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
267 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
268 t++;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
269
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
270 }
2048
3366311426df [gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2043
diff changeset
271 } else if (c != cpy && !g_strncasecmp(c, "@", 1)) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
272 char *tmp;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
273 int flag;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
274 int len = 0;
3330
af52fdf06166 [gaim-migrate @ 3348]
Christian Hammond <chipx86@chipx86.com>
parents: 3279
diff changeset
275 char illegal_chars[] = "!@#$%^&*()[]{}/|\\<>\":;\0";
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
276 url_buf[0] = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
277
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
278 if (*(c - 1) == ' ' || *(c + 1) == ' ' || rindex(illegal_chars, *(c + 1))
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
279 || *(c + 1) == 13 || *(c + 1) == 10)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
280 flag = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
281 else
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
282 flag = 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
283
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
284 t = c;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
285 while (flag) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
286 if (badchar(*t)) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
287 cnt -= (len - 1);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
288 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
289 } else {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
290 len++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
291 tmp = g_malloc(len + 1);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
292 tmp[len] = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
293 tmp[0] = *t;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
294 strncpy(tmp + 1, url_buf, len - 1);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
295 strcpy(url_buf, tmp);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
296 url_buf[len] = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
297 g_free(tmp);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
298 t--;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
299 if (t < cpy) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
300 cnt = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
301 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
302 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
303 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
304 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
305
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
306 t = c + 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
307
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
308 while (flag) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
309 if (badchar(*t)) {
3331
8f69ff64f0bf [gaim-migrate @ 3349]
Christian Hammond <chipx86@chipx86.com>
parents: 3330
diff changeset
310 char *d;
8f69ff64f0bf [gaim-migrate @ 3349]
Christian Hammond <chipx86@chipx86.com>
parents: 3330
diff changeset
311
8f69ff64f0bf [gaim-migrate @ 3349]
Christian Hammond <chipx86@chipx86.com>
parents: 3330
diff changeset
312 for (d = url_buf + strlen(url_buf) - 1; *d == '.'; d--, t--)
8f69ff64f0bf [gaim-migrate @ 3349]
Christian Hammond <chipx86@chipx86.com>
parents: 3330
diff changeset
313 *d = '\0';
3330
af52fdf06166 [gaim-migrate @ 3348]
Christian Hammond <chipx86@chipx86.com>
parents: 3279
diff changeset
314
2614
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
315 cnt += g_snprintf(&text[cnt], 1024,
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
316 "<A HREF=\"mailto:%s\">%s</A>", url_buf,
3e2f455cb924 [gaim-migrate @ 2627]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2603
diff changeset
317 url_buf);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
318 text[cnt] = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
319
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
320
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
321 c = t;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
322
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
323 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
324 } else {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
325 strncat(url_buf, t, 1);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
326 len++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
327 url_buf[len] = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
328 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
329
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
330 t++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
331 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
332 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
333
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
334 if (*c == 0)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
335 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
336
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
337 text[cnt++] = *c;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
338 c++;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
339
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
340 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
341 text[cnt] = 0;
845
647b110f7a1a [gaim-migrate @ 855]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 831
diff changeset
342 g_free(cpy);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
343 return cnt;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
344 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
345
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
346
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
347 FILE *open_gaim_log_file(char *name, int *flag)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
348 {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
349 char *buf;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
350 char *buf2;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
351 char log_all_file[256];
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
352 struct stat st;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
353 FILE *fd;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
354 #ifndef _WIN32
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
355 int res;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
356 #endif
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
357 gchar *gaim_dir;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
358
79
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 70
diff changeset
359 buf = g_malloc(BUF_LONG);
bfdc427b936d [gaim-migrate @ 89]
Rob Flynn <gaim@robflynn.com>
parents: 70
diff changeset
360 buf2 = g_malloc(BUF_LONG);
1238
78c4f497db2b [gaim-migrate @ 1248]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1202
diff changeset
361 gaim_dir = gaim_user_dir();
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
362
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
363 /* Dont log yourself */
1238
78c4f497db2b [gaim-migrate @ 1248]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1202
diff changeset
364 strncpy(log_all_file, gaim_dir, 256);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
365
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
366 #ifndef _WIN32
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
367 stat(log_all_file, &st);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
368 if (!S_ISDIR(st.st_mode))
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
369 unlink(log_all_file);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
370
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
371 fd = fopen(log_all_file, "r");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
372
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
373 if (!fd) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
374 res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
375 if (res < 0) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
376 g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging",
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
377 log_all_file);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3373
diff changeset
378 do_error_dialog(buf, NULL, GAIM_ERROR);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
379 g_free(buf);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
380 g_free(buf2);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
381 return NULL;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
382 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
383 } else
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
384 fclose(fd);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
385
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
386 g_snprintf(log_all_file, 256, "%s" G_DIR_SEPARATOR_S "logs", gaim_dir);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
387
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
388 if (stat(log_all_file, &st) < 0)
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
389 *flag = 1;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
390 if (!S_ISDIR(st.st_mode))
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
391 unlink(log_all_file);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
392
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
393 fd = fopen(log_all_file, "r");
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
394 if (!fd) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
395 res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
396 if (res < 0) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
397 g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging",
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
398 log_all_file);
3427
8fa61405af2b [gaim-migrate @ 3453]
Sean Egan <seanegan@gmail.com>
parents: 3373
diff changeset
399 do_error_dialog(buf, NULL, GAIM_ERROR);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
400 g_free(buf);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
401 g_free(buf2);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
402 return NULL;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
403 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
404 } else
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
405 fclose(fd);
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
406 #else /* _WIN32 */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
407 g_snprintf(log_all_file, 256, "%s" G_DIR_SEPARATOR_S "logs", gaim_dir);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
408
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
409 if( _mkdir(log_all_file) < 0 && errno != EEXIST ) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
410 g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging", log_all_file);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
411 do_error_dialog(buf, NULL, GAIM_ERROR);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
412 g_free(buf);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
413 g_free(buf2);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
414 return NULL;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
415 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
416 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
417
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
418 g_snprintf(log_all_file, 256, "%s" G_DIR_SEPARATOR_S "logs" G_DIR_SEPARATOR_S "%s", gaim_dir, name);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
419 if (stat(log_all_file, &st) < 0)
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
420 *flag = 1;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
421
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
422 debug_printf("Logging to: \"%s\"\n", log_all_file);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
423
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
424 fd = fopen(log_all_file, "a");
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
425
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
426 g_free(buf);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
427 g_free(buf2);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
428 return fd;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
429 }
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
430
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
431 FILE *open_log_file(char *name, int is_chat)
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
432 {
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
433 struct stat st;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
434 char realname[256];
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
435 struct log_conversation *l;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
436 FILE *fd;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
437 int flag = 0;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
438
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
439 if (((is_chat == 2) && !(logging_options & OPT_LOG_INDIVIDUAL))
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
440 || ((is_chat == 1) && !(logging_options & OPT_LOG_CHATS))
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
441 || ((is_chat == 0) && !(logging_options & OPT_LOG_CONVOS))) {
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
442
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
443 l = find_log_info(name);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
444 if (!l)
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
445 return NULL;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
446
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
447 if (stat(l->filename, &st) < 0)
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
448 flag = 1;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
449
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
450 fd = fopen(l->filename, "a");
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
451
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
452 if (flag) { /* is a new file */
1856
8f06476b1296 [gaim-migrate @ 1866]
Rob Flynn <gaim@robflynn.com>
parents: 1843
diff changeset
453 if (logging_options & OPT_LOG_STRIP_HTML) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
454 fprintf(fd, "IM Sessions with %s\n", name);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
455 } else {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
456 fprintf(fd, "<HTML><HEAD><TITLE>");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
457 fprintf(fd, "IM Sessions with %s", name);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
458 fprintf(fd, "</TITLE></HEAD><BODY BGCOLOR=\"ffffff\">\n");
1856
8f06476b1296 [gaim-migrate @ 1866]
Rob Flynn <gaim@robflynn.com>
parents: 1843
diff changeset
459 }
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
460 }
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
461
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
462 return fd;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
463 }
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
464
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
465 g_snprintf(realname, sizeof(realname), "%s.log", normalize(name));
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
466 fd = open_gaim_log_file(realname, &flag);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
467
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
468 if (fd && flag) { /* is a new file */
1856
8f06476b1296 [gaim-migrate @ 1866]
Rob Flynn <gaim@robflynn.com>
parents: 1843
diff changeset
469 if (logging_options & OPT_LOG_STRIP_HTML) {
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
470 fprintf(fd, "IM Sessions with %s\n", name);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
471 } else {
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
472 fprintf(fd, "<HTML><HEAD><TITLE>");
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
473 fprintf(fd, "IM Sessions with %s", name);
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
474 fprintf(fd, "</TITLE></HEAD><BODY BGCOLOR=\"ffffff\">\n");
1856
8f06476b1296 [gaim-migrate @ 1866]
Rob Flynn <gaim@robflynn.com>
parents: 1843
diff changeset
475 }
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
476 }
25
c56db1b46b0d [gaim-migrate @ 34]
Rob Flynn <gaim@robflynn.com>
parents: 17
diff changeset
477
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
478 return fd;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
479 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
480
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
481 FILE *open_system_log_file(char *name)
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
482 {
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
483 int x;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
484
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
485 if (name)
3457
222e23f91092 [gaim-migrate @ 3505]
Sean Egan <seanegan@gmail.com>
parents: 3427
diff changeset
486 return open_log_file(name, 2);
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
487 else
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
488 return open_gaim_log_file("system", &x);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
489 }
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
490
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
491 char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" "0123456789+/";
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
492
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3105
diff changeset
493 /* XXX Find bug */
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
494 char *tobase64(const char *text)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
495 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
496 char *out = NULL;
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
497 const char *c;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
498 unsigned int tmp = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
499 int len = 0, n = 0;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
500
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
501 c = text;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
502
1829
bdfb37ae28b4 [gaim-migrate @ 1839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1826
diff changeset
503 while (*c) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
504 tmp = tmp << 8;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
505 tmp += *c;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
506 n++;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
507
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
508 if (n == 3) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
509 out = g_realloc(out, len + 4);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
510 out[len] = alphabet[(tmp >> 18) & 0x3f];
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
511 out[len + 1] = alphabet[(tmp >> 12) & 0x3f];
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
512 out[len + 2] = alphabet[(tmp >> 6) & 0x3f];
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
513 out[len + 3] = alphabet[tmp & 0x3f];
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
514 len += 4;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
515 tmp = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
516 n = 0;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
517 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
518 c++;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
519 }
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
520 switch (n) {
1238
78c4f497db2b [gaim-migrate @ 1248]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1202
diff changeset
521
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
522 case 2:
1829
bdfb37ae28b4 [gaim-migrate @ 1839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1826
diff changeset
523 tmp <<= 8;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
524 out = g_realloc(out, len + 5);
1829
bdfb37ae28b4 [gaim-migrate @ 1839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1826
diff changeset
525 out[len] = alphabet[(tmp >> 18) & 0x3f];
bdfb37ae28b4 [gaim-migrate @ 1839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1826
diff changeset
526 out[len + 1] = alphabet[(tmp >> 12) & 0x3f];
bdfb37ae28b4 [gaim-migrate @ 1839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1826
diff changeset
527 out[len + 2] = alphabet[(tmp >> 6) & 0x3f];
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
528 out[len + 3] = '=';
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
529 out[len + 4] = 0;
1238
78c4f497db2b [gaim-migrate @ 1248]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1202
diff changeset
530 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
531 case 1:
1829
bdfb37ae28b4 [gaim-migrate @ 1839]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1826
diff changeset
532 tmp <<= 16;
1843
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1829
diff changeset
533 out = g_realloc(out, len + 5);
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1829
diff changeset
534 out[len] = alphabet[(tmp >> 18) & 0x3f];
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1829
diff changeset
535 out[len + 1] = alphabet[(tmp >> 12) & 0x3f];
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
536 out[len + 2] = '=';
1843
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1829
diff changeset
537 out[len + 3] = '=';
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1829
diff changeset
538 out[len + 4] = 0;
1238
78c4f497db2b [gaim-migrate @ 1248]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1202
diff changeset
539 break;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
540 case 0:
1843
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1829
diff changeset
541 out = g_realloc(out, len + 1);
4dbd8533d209 [gaim-migrate @ 1853]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1829
diff changeset
542 out[len] = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
543 break;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
544 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
545 return out;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
546 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
547
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
548
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
549 void frombase64(const char *text, char **data, int *size)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
550 {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
551 char *out = NULL;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
552 char tmp = 0;
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
553 const char *c;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
554 gint32 tmp2 = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
555 int len = 0, n = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
556
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
557 if (!text || !data)
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
558 return;
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
559
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
560 c = text;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
561
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
562 while (*c) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
563 if (*c >= 'A' && *c <= 'Z') {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
564 tmp = *c - 'A';
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
565 } else if (*c >= 'a' && *c <= 'z') {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
566 tmp = 26 + (*c - 'a');
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
567 } else if (*c >= '0' && *c <= 57) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
568 tmp = 52 + (*c - '0');
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
569 } else if (*c == '+') {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
570 tmp = 62;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
571 } else if (*c == '/') {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
572 tmp = 63;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
573 } else if (*c == '=') {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
574 if (n == 3) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
575 out = g_realloc(out, len + 2);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
576 out[len] = (char)(tmp2 >> 10) & 0xff;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
577 len++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
578 out[len] = (char)(tmp2 >> 2) & 0xff;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
579 len++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
580 } else if (n == 2) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
581 out = g_realloc(out, len + 1);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
582 out[len] = (char)(tmp2 >> 4) & 0xff;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
583 len++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
584 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
585 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
586 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
587 tmp2 = ((tmp2 << 6) | (tmp & 0xff));
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
588 n++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
589 if (n == 4) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
590 out = g_realloc(out, len + 3);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
591 out[len] = (char)((tmp2 >> 16) & 0xff);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
592 len++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
593 out[len] = (char)((tmp2 >> 8) & 0xff);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
594 len++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
595 out[len] = (char)(tmp2 & 0xff);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
596 len++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
597 tmp2 = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
598 n = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
599 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
600 c++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
601 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
602
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
603 out = g_realloc(out, len + 1);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
604 out[len] = 0;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
605
1920
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
606 *data = out;
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
607 if (size)
5bed3bc833b5 [gaim-migrate @ 1930]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1878
diff changeset
608 *size = len;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
609 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
610
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
611
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
612 char *normalize(const char *s)
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
613 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
614 static char buf[BUF_LEN];
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
615 char *t, *u;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
616 int x = 0;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
617
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
618 g_return_val_if_fail((s != NULL), NULL);
26
b9e90a914e20 [gaim-migrate @ 35]
Rob Flynn <gaim@robflynn.com>
parents: 25
diff changeset
619
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
620 u = t = g_strdup(s);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
621
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
622 strcpy(t, s);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
623 g_strdown(t);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
624
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
625 while (*t && (x < BUF_LEN - 1)) {
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
626 if (*t != ' ') {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
627 buf[x] = *t;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
628 x++;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
629 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
630 t++;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
631 }
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
632 buf[x] = '\0';
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
633 g_free(u);
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
634 return buf;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
635 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
636
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
637 char *date()
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
638 {
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
639 static char date[80];
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
640 time_t tme;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
641 time(&tme);
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
642 strftime(date, sizeof(date), "%H:%M:%S", localtime(&tme));
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
643 return date;
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
644 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
645
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
646
3076
a7e03c5d2205 [gaim-migrate @ 3090]
Rob Flynn <gaim@robflynn.com>
parents: 2956
diff changeset
647 void clean_pid(void)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
648 {
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
649 #ifndef _WIN32
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
650 int status;
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
651 pid_t pid, spell_pid;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
652
3105
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
653 while((pid = waitpid(-1, &status, WNOHANG)) > 0) {
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
654 if((spell_pid = gtkspell_running()) != 0 && pid == spell_pid) {
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
655 gtkspell_notrunning();
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
656 }
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
657 }
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
658 if(pid < 0 && errno != ECHILD) {
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
659 char errmsg[BUFSIZ];
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
660 sprintf(errmsg, "Warning: waitpid() returned %d", pid);
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
661 perror(errmsg);
da324fe688b3 [gaim-migrate @ 3119]
Sean Egan <seanegan@gmail.com>
parents: 3076
diff changeset
662 }
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
663 #endif
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
664 }
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
665
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1009
diff changeset
666 struct aim_user *find_user(const char *name, int protocol)
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
667 {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
668 char *who = g_strdup(normalize(name));
2397
520257562955 [gaim-migrate @ 2410]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2382
diff changeset
669 GSList *usr = aim_users;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
670 struct aim_user *u;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
671
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
672 while (usr) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
673 u = (struct aim_user *)usr->data;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
674 if (!strcmp(normalize(u->username), who)) {
1030
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1009
diff changeset
675 if (protocol != -1) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1009
diff changeset
676 if (u->protocol == protocol) {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1009
diff changeset
677 g_free(who);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1009
diff changeset
678 return u;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1009
diff changeset
679 }
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1009
diff changeset
680 } else {
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1009
diff changeset
681 g_free(who);
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1009
diff changeset
682 return u;
38452403563b [gaim-migrate @ 1040]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1009
diff changeset
683 }
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
684
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
685 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
686 usr = usr->next;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
687 }
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
688 g_free(who);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
689 return NULL;
1
2846a03bda67 [gaim-migrate @ 10]
Rob Flynn <gaim@robflynn.com>
parents:
diff changeset
690 }
180
0ff9f19b9b23 [gaim-migrate @ 190]
Rob Flynn <gaim@robflynn.com>
parents: 79
diff changeset
691
206
610b7ffc4821 [gaim-migrate @ 216]
Rob Flynn <gaim@robflynn.com>
parents: 194
diff changeset
692
592
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
693 /* Look for %n, %d, or %t in msg, and replace with the sender's name, date,
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
694 or time */
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
695 char *away_subs(char *msg, char *name)
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
696 {
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
697 char *c;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
698 static char cpy[BUF_LONG];
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
699 int cnt = 0;
592
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
700 time_t t = time(0);
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
701 struct tm *tme = localtime(&t);
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
702 char tmp[20];
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
703
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
704 cpy[0] = '\0';
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
705 c = msg;
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
706 while (*c) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
707 switch (*c) {
592
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
708 case '%':
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
709 if (*(c + 1)) {
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
710 switch (*(c + 1)) {
592
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
711 case 'n':
1976
24aed1c31342 [gaim-migrate @ 1986]
Rob Flynn <gaim@robflynn.com>
parents: 1949
diff changeset
712 /* append name */
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
713 strcpy(cpy + cnt, name);
592
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
714 cnt += strlen(name);
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
715 c++;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
716 break;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
717 case 'd':
1976
24aed1c31342 [gaim-migrate @ 1986]
Rob Flynn <gaim@robflynn.com>
parents: 1949
diff changeset
718 /* append date */
2161
757e10018950 [gaim-migrate @ 2171]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2155
diff changeset
719 strftime(tmp, 20, "%m/%d/%Y", tme);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
720 strcpy(cpy + cnt, tmp);
592
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
721 cnt += strlen(tmp);
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
722 c++;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
723 break;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
724 case 't':
1976
24aed1c31342 [gaim-migrate @ 1986]
Rob Flynn <gaim@robflynn.com>
parents: 1949
diff changeset
725 /* append time */
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
726 strftime(tmp, 20, "%r", tme);
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
727 strcpy(cpy + cnt, tmp);
592
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
728 cnt += strlen(tmp);
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
729 c++;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
730 break;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
731 default:
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
732 cpy[cnt++] = *c;
592
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
733 }
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
734 }
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
735 break;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
736 default:
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
737 cpy[cnt++] = *c;
592
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
738 }
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
739 c++;
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
740 }
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
741 cpy[cnt] = '\0';
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
742 return (cpy);
592
7c75d69a1129 [gaim-migrate @ 602]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 470
diff changeset
743 }
603
9b0717b4a490 [gaim-migrate @ 613]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 592
diff changeset
744
765
bf31bf916f53 [gaim-migrate @ 775]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 764
diff changeset
745 char *stylize(gchar *text, int length)
764
a566fc987db9 [gaim-migrate @ 774]
Todd Kulesza <fflewddur>
parents: 759
diff changeset
746 {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
747 gchar *buf;
2016
9a2e3902658c [gaim-migrate @ 2026]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1985
diff changeset
748 char *tmp = g_malloc(length);
764
a566fc987db9 [gaim-migrate @ 774]
Todd Kulesza <fflewddur>
parents: 759
diff changeset
749
a566fc987db9 [gaim-migrate @ 774]
Todd Kulesza <fflewddur>
parents: 759
diff changeset
750 buf = g_malloc(length);
765
bf31bf916f53 [gaim-migrate @ 775]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 764
diff changeset
751 g_snprintf(buf, length, "%s", text);
764
a566fc987db9 [gaim-migrate @ 774]
Todd Kulesza <fflewddur>
parents: 759
diff changeset
752
831
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
753 if (font_options & OPT_FONT_BOLD) {
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
754 g_snprintf(tmp, length, "<B>%s</B>", buf);
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
755 strcpy(buf, tmp);
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
756 }
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
757
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
758 if (font_options & OPT_FONT_ITALIC) {
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
759 g_snprintf(tmp, length, "<I>%s</I>", buf);
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
760 strcpy(buf, tmp);
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
761 }
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
762
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
763 if (font_options & OPT_FONT_UNDERLINE) {
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
764 g_snprintf(tmp, length, "<U>%s</U>", buf);
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
765 strcpy(buf, tmp);
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
766 }
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
767
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
768 if (font_options & OPT_FONT_STRIKE) {
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
769 g_snprintf(tmp, length, "<S>%s</S>", buf);
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
770 strcpy(buf, tmp);
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
771 }
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
772
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
773 if (font_options & OPT_FONT_FACE) {
765
bf31bf916f53 [gaim-migrate @ 775]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 764
diff changeset
774 g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, buf);
bf31bf916f53 [gaim-migrate @ 775]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 764
diff changeset
775 strcpy(buf, tmp);
764
a566fc987db9 [gaim-migrate @ 774]
Todd Kulesza <fflewddur>
parents: 759
diff changeset
776 }
a566fc987db9 [gaim-migrate @ 774]
Todd Kulesza <fflewddur>
parents: 759
diff changeset
777
1441
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
778 if (font_options & OPT_FONT_SIZE) {
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
779 g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf);
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
780 strcpy(buf, tmp);
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
781 }
5c67b8794991 [gaim-migrate @ 1451]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1376
diff changeset
782
831
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
783 if (font_options & OPT_FONT_FGCOL) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
784 g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", fgcolor.red,
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
785 fgcolor.green, fgcolor.blue, buf);
765
bf31bf916f53 [gaim-migrate @ 775]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 764
diff changeset
786 strcpy(buf, tmp);
764
a566fc987db9 [gaim-migrate @ 774]
Todd Kulesza <fflewddur>
parents: 759
diff changeset
787 }
a566fc987db9 [gaim-migrate @ 774]
Todd Kulesza <fflewddur>
parents: 759
diff changeset
788
831
97f1ae636ed7 [gaim-migrate @ 841]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 804
diff changeset
789 if (font_options & OPT_FONT_BGCOL) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
790 g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", bgcolor.red,
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
791 bgcolor.green, bgcolor.blue, buf);
765
bf31bf916f53 [gaim-migrate @ 775]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 764
diff changeset
792 strcpy(buf, tmp);
764
a566fc987db9 [gaim-migrate @ 774]
Todd Kulesza <fflewddur>
parents: 759
diff changeset
793 }
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
794
2016
9a2e3902658c [gaim-migrate @ 2026]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1985
diff changeset
795 g_free(tmp);
765
bf31bf916f53 [gaim-migrate @ 775]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 764
diff changeset
796 return buf;
bf31bf916f53 [gaim-migrate @ 775]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 764
diff changeset
797 }
915
378c862a2381 [gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 856
diff changeset
798
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
799 void show_usage(int mode, char *name)
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 976
diff changeset
800 {
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 976
diff changeset
801 switch (mode) {
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
802 case 0: /* full help text */
3474
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
803 printf("Gaim %s\n"
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
804 "Usage: %s [OPTION]...\n\n"
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
805 " -a, --acct display account editor window\n"
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
806 " -w, --away[=MESG] make away on signon (optional argument MESG specifies\n"
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
807 " name of away message to use)\n"
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
808 " -l, --login[=NAME] automatically login (optional argument NAME specifies\n"
3726
d85208a99af2 [gaim-migrate @ 3862]
Luke Schierer <lschiere@pidgin.im>
parents: 3699
diff changeset
809 " account(s) to use, seperated by commas)\n"
3530
f38516e5d1ab [gaim-migrate @ 3603]
Sean Egan <seanegan@gmail.com>
parents: 3479
diff changeset
810 " -n, --loginwin don't automatically login; show login window\n"
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
811 " -u, --user=NAME use account NAME\n"
1560
72235e3fcff6 [gaim-migrate @ 1570]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1525
diff changeset
812 " -f, --file=FILE use FILE as config\n"
2823
cd23279122ed [gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2662
diff changeset
813 " -d, --debug print debugging messages to stdout\n"
3474
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
814 " -v, --version display the current version and exit\n"
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
815 " -h, --help display this help and exit\n", VERSION, name);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
816 break;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
817 case 1: /* short message */
3474
cfbdfe334975 [gaim-migrate @ 3525]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
818 printf("Gaim %s. Try `%s -h' for more information.\n", VERSION, name);
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
819 break;
1009
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 976
diff changeset
820 }
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 976
diff changeset
821 }
d496fe2614a6 [gaim-migrate @ 1019]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 976
diff changeset
822
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
823 GSList *message_split(char *message, int limit)
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
824 {
1100
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
825 static GSList *ret = NULL;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
826 int lastgood = 0, curgood = 0, curpos = 0, len = strlen(message);
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
827 gboolean intag = FALSE;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
828
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
829 if (ret) {
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
830 GSList *tmp = ret;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
831 while (tmp) {
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
832 g_free(tmp->data);
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
833 tmp = g_slist_remove(tmp, tmp->data);
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
834 }
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
835 ret = NULL;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
836 }
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
837
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
838 while (TRUE) {
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
839 if (lastgood >= len)
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
840 return ret;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
841
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
842 if (len - lastgood < limit) {
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
843 ret = g_slist_append(ret, g_strdup(&message[lastgood]));
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
844 return ret;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
845 }
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
846
1100
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
847 curgood = curpos = 0;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
848 intag = FALSE;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
849 while (curpos <= limit) {
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
850 if (isspace(message[curpos + lastgood]) && !intag)
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
851 curgood = curpos;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
852 if (message[curpos + lastgood] == '<')
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
853 intag = TRUE;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
854 if (message[curpos + lastgood] == '>')
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
855 intag = FALSE;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
856 curpos++;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
857 }
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
858
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
859 if (curgood) {
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
860 ret = g_slist_append(ret, g_strndup(&message[lastgood], curgood));
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
861 if (isspace(message[curgood + lastgood]))
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
862 lastgood += curgood + 1;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
863 else
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
864 lastgood += curgood;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
865 } else {
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
866 /* whoops, guess we have to fudge it here */
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
867 ret = g_slist_append(ret, g_strndup(&message[lastgood], limit));
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
868 lastgood += limit;
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
869 }
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
870 }
f168625b63fe [gaim-migrate @ 1110]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1087
diff changeset
871 }
1191
4fd0d35826fe [gaim-migrate @ 1201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
872
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
873 gchar *gaim_home_dir()
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
874 {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
875 if(g_get_home_dir())
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
876 return g_get_home_dir();
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
877 else
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
878 #ifndef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
879 return NULL;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
880 #else
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
881 /* Win9x and WinME don't have a home dir */
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
882 return "C:";
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
883 #endif
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
884
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
885 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
886
1238
78c4f497db2b [gaim-migrate @ 1248]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1202
diff changeset
887 /* returns a string of the form ~/.gaim, where ~ is replaced by the user's home
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
888 * dir. Note that there is no trailing slash after .gaim. */
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
889 gchar *gaim_user_dir()
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
890 {
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
891 if(gaim_home_dir()) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
892 strcpy( (char*)&home_dir, gaim_home_dir() );
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
893 strcat( (char*)&home_dir, G_DIR_SEPARATOR_S ".gaim" );
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
894 return (gchar*)&home_dir;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
895 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
896 else {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
897 return NULL;
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
898 }
1238
78c4f497db2b [gaim-migrate @ 1248]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1202
diff changeset
899 }
78c4f497db2b [gaim-migrate @ 1248]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1202
diff changeset
900
1292
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
901 /*
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
902 * rcg10312000 This could be more robust, but it works for my current
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
903 * goal: to remove those annoying <BR> tags. :)
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
904 * dtf12162000 made the loop more readable. i am a neat freak. ;) */
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
905 void strncpy_nohtml(gchar *dest, const gchar *src, size_t destsize)
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
906 {
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
907 gchar *ptr;
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
908 g_snprintf(dest, destsize, "%s", src);
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
909
1815
f15d449b3167 [gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1805
diff changeset
910 while ((ptr = strstr(dest, "<BR>")) != NULL) {
1292
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
911 /* replace <BR> with a newline. */
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
912 *ptr = '\n';
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
913 memmove(ptr + 1, ptr + 4, strlen(ptr + 4) + 1);
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
914 }
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
915 }
cb84b5c6d9ab [gaim-migrate @ 1302]
Rob Flynn <gaim@robflynn.com>
parents: 1269
diff changeset
916
1191
4fd0d35826fe [gaim-migrate @ 1201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
917 void strncpy_withhtml(gchar *dest, const gchar *src, size_t destsize)
4fd0d35826fe [gaim-migrate @ 1201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
918 {
1202
d5146df6d2ab [gaim-migrate @ 1212]
Rob Flynn <gaim@robflynn.com>
parents: 1197
diff changeset
919 gchar *end = dest + destsize;
1191
4fd0d35826fe [gaim-migrate @ 1201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
920
1293
fbc0cbf24a62 [gaim-migrate @ 1303]
Rob Flynn <gaim@robflynn.com>
parents: 1292
diff changeset
921 while (dest < end) {
fbc0cbf24a62 [gaim-migrate @ 1303]
Rob Flynn <gaim@robflynn.com>
parents: 1292
diff changeset
922 if (*src == '\n' && dest < end - 5) {
1202
d5146df6d2ab [gaim-migrate @ 1212]
Rob Flynn <gaim@robflynn.com>
parents: 1197
diff changeset
923 strcpy(dest, "<BR>");
1252
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
924 src++;
46c09828e929 [gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1250
diff changeset
925 dest += 4;
1293
fbc0cbf24a62 [gaim-migrate @ 1303]
Rob Flynn <gaim@robflynn.com>
parents: 1292
diff changeset
926 } else {
fbc0cbf24a62 [gaim-migrate @ 1303]
Rob Flynn <gaim@robflynn.com>
parents: 1292
diff changeset
927 *dest++ = *src;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
928 if (*src == '\0')
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
929 return;
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
930 else
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
931 src++;
1293
fbc0cbf24a62 [gaim-migrate @ 1303]
Rob Flynn <gaim@robflynn.com>
parents: 1292
diff changeset
932 }
1191
4fd0d35826fe [gaim-migrate @ 1201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
933 }
4fd0d35826fe [gaim-migrate @ 1201]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1152
diff changeset
934 }
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
935
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
936
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
937 /*
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
938 * Like strncpy_withhtml (above), but malloc()'s the necessary space
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
939 *
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
940 * The caller is responsible for freeing the space pointed to by the
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
941 * return value.
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
942 */
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
943
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
944 gchar *strdup_withhtml(const gchar *src)
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
945 {
3279
86fdd015f40e [gaim-migrate @ 3297]
Sean Egan <seanegan@gmail.com>
parents: 3233
diff changeset
946 gchar *sp, *dest;
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
947 gulong destsize;
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
948
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
949 /*
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
950 * All we need do is multiply the number of newlines by 3 (the
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
951 * additional length of "<BR>" over "\n"), account for the
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
952 * terminator, malloc the space and call strncpy_withhtml.
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
953 */
3279
86fdd015f40e [gaim-migrate @ 3297]
Sean Egan <seanegan@gmail.com>
parents: 3233
diff changeset
954 for(destsize = 0, sp = (gchar *)src; (sp = strchr(sp, '\n')) != NULL; ++sp, ++destsize)
2956
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
955 ;
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
956 destsize *= 3;
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
957 destsize += strlen(src) + 1;
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
958 dest = g_malloc(destsize);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
959 strncpy_withhtml(dest, src, destsize);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
960
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
961 return(dest);
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
962 }
b68c648618a3 [gaim-migrate @ 2969]
Rob Flynn <gaim@robflynn.com>
parents: 2823
diff changeset
963
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
964 void away_on_login(char *mesg)
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
965 {
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
966 GSList *awy = away_messages;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
967 struct away_message *a, *message = NULL;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
968
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
969 if (!blist) {
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
970 return;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
971 }
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
972
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
973 if (mesg == NULL) {
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
974 /* Use default message */
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
975 do_away_message(NULL, default_away);
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
976 } else {
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
977 /* Use argument */
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
978 while (awy) {
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
979 a = (struct away_message *)awy->data;
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
980 if (strcmp(a->name, mesg) == 0) {
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
981 message = a;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
982 break;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
983 }
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
984 awy = awy->next;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
985 }
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
986 if (message == NULL)
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
987 message = default_away;
2379
cacaf7ace3a5 [gaim-migrate @ 2392]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2372
diff changeset
988 do_away_message(NULL, message);
1254
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
989 }
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
990 return;
9da444224f0e [gaim-migrate @ 1264]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1252
diff changeset
991 }
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
992
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
993 void system_log(enum log_event what, struct gaim_connection *gc, struct buddy *who, int why)
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
994 {
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
995 FILE *fd;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
996 char text[256], html[256];
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
997
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
998 if ((logging_options & why) != why)
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
999 return;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1000
1609
b4473be6fcc5 [gaim-migrate @ 1619]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1575
diff changeset
1001 if (logging_options & OPT_LOG_INDIVIDUAL) {
b4473be6fcc5 [gaim-migrate @ 1619]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1575
diff changeset
1002 if (why & OPT_LOG_MY_SIGNON)
b4473be6fcc5 [gaim-migrate @ 1619]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1575
diff changeset
1003 fd = open_system_log_file(gc ? gc->username : NULL);
b4473be6fcc5 [gaim-migrate @ 1619]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1575
diff changeset
1004 else
b4473be6fcc5 [gaim-migrate @ 1619]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1575
diff changeset
1005 fd = open_system_log_file(who->name);
b4473be6fcc5 [gaim-migrate @ 1619]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1575
diff changeset
1006 } else
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1007 fd = open_system_log_file(NULL);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1008
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1009 if (!fd)
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1010 return;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1011
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1012 if (why & OPT_LOG_MY_SIGNON) {
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1013 switch (what) {
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1014 case log_signon:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1015 g_snprintf(text, sizeof(text), "+++ %s (%s) signed on @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1016 gc->username, gc->prpl->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1017 g_snprintf(html, sizeof(html), "<B>%s</B>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1018 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1019 case log_signoff:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1020 g_snprintf(text, sizeof(text), "+++ %s (%s) signed off @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1021 gc->username, gc->prpl->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1022 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1023 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1024 case log_away:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1025 g_snprintf(text, sizeof(text), "+++ %s (%s) changed away state @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1026 gc->username, gc->prpl->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1027 g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1028 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1029 case log_back:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1030 g_snprintf(text, sizeof(text), "+++ %s (%s) came back @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1031 gc->username, gc->prpl->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1032 g_snprintf(html, sizeof(html), "%s", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1033 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1034 case log_idle:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1035 g_snprintf(text, sizeof(text), "+++ %s (%s) became idle @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1036 gc->username, gc->prpl->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1037 g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1038 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1039 case log_unidle:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1040 g_snprintf(text, sizeof(text), "+++ %s (%s) returned from idle @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1041 gc->username, gc->prpl->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1042 g_snprintf(html, sizeof(html), "%s", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1043 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1044 case log_quit:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1045 g_snprintf(text, sizeof(text), "+++ Program exit @ %s", full_date());
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1046 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1047 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1048 }
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1049 } else if (strcmp(who->name, who->show)) {
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1050 switch (what) {
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1051 case log_signon:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1052 g_snprintf(text, sizeof(text), "%s (%s) reported that %s (%s) signed on @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1053 gc->username, gc->prpl->name, who->show, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1054 g_snprintf(html, sizeof(html), "<B>%s</B>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1055 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1056 case log_signoff:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1057 g_snprintf(text, sizeof(text), "%s (%s) reported that %s (%s) signed off @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1058 gc->username, gc->prpl->name, who->show, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1059 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1060 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1061 case log_away:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1062 g_snprintf(text, sizeof(text), "%s (%s) reported that %s (%s) went away @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1063 gc->username, gc->prpl->name, who->show, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1064 g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1065 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1066 case log_back:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1067 g_snprintf(text, sizeof(text), "%s (%s) reported that %s (%s) came back @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1068 gc->username, gc->prpl->name, who->show, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1069 g_snprintf(html, sizeof(html), "%s", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1070 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1071 case log_idle:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1072 g_snprintf(text, sizeof(text), "%s (%s) reported that %s (%s) became idle @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1073 gc->username, gc->prpl->name, who->show, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1074 g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1075 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1076 case log_unidle:
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1077 g_snprintf(text, sizeof(text),
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1078 "%s (%s) reported that %s (%s) returned from idle @ %s", gc->username,
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1079 gc->prpl->name, who->show, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1080 g_snprintf(html, sizeof(html), "%s", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1081 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1082 default:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1083 fclose(fd);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1084 return;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1085 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1086 }
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1087 } else {
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1088 switch (what) {
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1089 case log_signon:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1090 g_snprintf(text, sizeof(text), "%s (%s) reported that %s signed on @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1091 gc->username, gc->prpl->name, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1092 g_snprintf(html, sizeof(html), "<B>%s</B>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1093 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1094 case log_signoff:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1095 g_snprintf(text, sizeof(text), "%s (%s) reported that %s signed off @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1096 gc->username, gc->prpl->name, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1097 g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1098 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1099 case log_away:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1100 g_snprintf(text, sizeof(text), "%s (%s) reported that %s went away @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1101 gc->username, gc->prpl->name, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1102 g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1103 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1104 case log_back:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1105 g_snprintf(text, sizeof(text), "%s (%s) reported that %s came back @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1106 gc->username, gc->prpl->name, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1107 g_snprintf(html, sizeof(html), "%s", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1108 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1109 case log_idle:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1110 g_snprintf(text, sizeof(text), "%s (%s) reported that %s became idle @ %s",
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1111 gc->username, gc->prpl->name, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1112 g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1113 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1114 case log_unidle:
2372
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1115 g_snprintf(text, sizeof(text),
2927c2c26fe6 [gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2371
diff changeset
1116 "%s (%s) reported that %s returned from idle @ %s", gc->username,
3572
bdd0bebd2d04 [gaim-migrate @ 3670]
Sean Egan <seanegan@gmail.com>
parents: 3530
diff changeset
1117 gc->prpl->name, who->name, full_date());
1575
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1118 g_snprintf(html, sizeof(html), "%s", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1119 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1120 default:
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1121 fclose(fd);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1122 return;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1123 break;
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1124 }
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1125 }
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1126
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1127 if (logging_options & OPT_LOG_STRIP_HTML) {
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1128 fprintf(fd, "---- %s ----\n", text);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1129 } else {
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1130 if (logging_options & OPT_LOG_INDIVIDUAL)
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1131 fprintf(fd, "<HR>%s<BR><HR><BR>\n", html);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1132 else
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1133 fprintf(fd, "%s<BR>\n", html);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1134 }
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1135
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1136 fclose(fd);
427e1409917c [gaim-migrate @ 1585]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1560
diff changeset
1137 }
1805
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1138
2603
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1139 void strip_linefeed(gchar *text)
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1140 {
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1141 int i, j;
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1142 gchar *text2 = g_malloc(strlen(text) + 1);
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1143
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1144 for (i = 0, j = 0; text[i]; i++)
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1145 if (text[i] != '\r')
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1146 text2[j++] = text[i];
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1147 text2[j] = '\0';
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1148
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1149 strcpy(text, text2);
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1150 g_free(text2);
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1151 }
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1152
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1153 char *add_cr(char *text)
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1154 {
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1155 char *ret = NULL;
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1156 int count = 0, i, j;
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1157
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1158 if (text[0] == '\n')
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1159 count++;
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1160 for (i = 1; i < strlen(text); i++)
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1161 if (text[i] == '\n' && text[i - 1] != '\r')
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1162 count++;
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1163
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1164 if (count == 0)
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1165 return g_strdup(text);
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1166
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1167 ret = g_malloc0(strlen(text) + count + 1);
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1168
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1169 i = 0; j = 0;
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1170 if (text[i] == '\n')
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1171 ret[j++] = '\r';
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1172 ret[j++] = text[i++];
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1173 for (; i < strlen(text); i++) {
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1174 if (text[i] == '\n' && text[i - 1] != '\r')
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1175 ret[j++] = '\r';
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1176 ret[j++] = text[i];
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1177 }
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1178
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1179 debug_printf("got: %s, leaving with %s\n", text, ret);
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1180
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1181 return ret;
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1182 }
24664768a739 [gaim-migrate @ 2616]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2596
diff changeset
1183
1805
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1184 time_t get_time(int year, int month, int day, int hour, int min, int sec)
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1185 {
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1186 struct tm tm;
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1187
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1188 tm.tm_year = year - 1900;
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1189 tm.tm_mon = month - 1;
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1190 tm.tm_mday = day;
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1191 tm.tm_hour = hour;
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1192 tm.tm_min = min;
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1193 tm.tm_sec = sec >= 0 ? sec : time(NULL) % 60;
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1194 return mktime(&tm);
caa605e70917 [gaim-migrate @ 1815]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 1753
diff changeset
1195 }
3230
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1196
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1197 /*
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1198 * Like mkstemp() but returns a file pointer, uses a pre-set template,
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1199 * uses the semantics of tempnam() for the directory to use and allocates
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1200 * the space for the filepath.
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1201 *
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1202 * Caller is responsible for closing the file and removing it when done,
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1203 * as well as freeing the space pointed-to by "path" with g_free().
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1204 *
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1205 * Returns NULL on failure and cleans up after itself if so.
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1206 */
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1207 static const char *gaim_mkstemp_templ = {"gaimXXXXXX"};
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1208
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1209 FILE *gaim_mkstemp(gchar **fpath)
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1210 {
3466
7a3f16a375a5 [gaim-migrate @ 3516]
Sean Egan <seanegan@gmail.com>
parents: 3457
diff changeset
1211 const gchar *tmpdir;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1212 #ifndef _WIN32
3230
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1213 int fd;
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1214 #endif
3230
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1215 FILE *fp = NULL;
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1216
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1217 if((tmpdir = (gchar*)g_get_tmp_dir()) != NULL) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1218 if((*fpath = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", tmpdir, gaim_mkstemp_templ)) != NULL) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1219 #ifdef _WIN32
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1220 char* result = _mktemp( *fpath );
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1221 if( result == NULL )
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1222 debug_printf("gaim_mkstemp: Problem creating the template\n");
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1223 else
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1224 {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1225 if( (fp = fopen( result, "w+" )) == NULL ) {
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1226 debug_printf("Error: Couldn't fopen()in gaim_mkstemp():\n%s\n", result);
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1227 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1228 }
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1229 #else
3230
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1230 if((fd = mkstemp(*fpath)) == -1) {
3232
cf460a8c859c [gaim-migrate @ 3249]
Jim Seymour <jseymour>
parents: 3230
diff changeset
1231 debug_printf("Error: Couldn't make \"%s\", error: %d\n", *fpath, errno);
3230
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1232 } else {
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1233 if((fp = fdopen(fd, "r+")) == NULL) {
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1234 close(fd);
3232
cf460a8c859c [gaim-migrate @ 3249]
Jim Seymour <jseymour>
parents: 3230
diff changeset
1235 debug_printf("Error: Couldn't fdopen(), error: %d\n", errno);
3230
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1236 }
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1237 }
3630
9682c0e022c6 [gaim-migrate @ 3753]
Rob Flynn <gaim@robflynn.com>
parents: 3572
diff changeset
1238 #endif
3230
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1239 if(!fp) {
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1240 g_free(*fpath);
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1241 *fpath = NULL;
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1242 }
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1243 }
3233
96e215745dc0 [gaim-migrate @ 3250]
Jim Seymour <jseymour>
parents: 3232
diff changeset
1244 } else {
96e215745dc0 [gaim-migrate @ 3250]
Jim Seymour <jseymour>
parents: 3232
diff changeset
1245 debug_printf("Error: g_get_tmp_dir() failed in gaim_mkstemp()!\n");
3230
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1246 }
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1247
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1248 return fp;
d05dc05bde8a [gaim-migrate @ 3247]
Jim Seymour <jseymour>
parents: 3153
diff changeset
1249 }
3478
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1250
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1251 /* AIM URI's ARE FUN :-D */
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1252 const char *handle_uri(char *uri) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1253 GString *str;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1254 GSList *conn = connections;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1255 struct gaim_connection *gc;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1256
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1257 debug_printf("Handling URI: %s\n", uri);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1258
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1259 /* Well, we'd better check to make sure we have at least one
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1260 AIM account connected. */
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1261 while (gc = conn->data) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1262 if (gc->protocol == PROTO_TOC) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1263 break;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1264 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1265 conn = conn->next;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1266 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1267
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1268 if (gc == NULL)
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1269 return "Not connected to AIM";
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1270
3479
84df15473af6 [gaim-migrate @ 3533]
Sean Egan <seanegan@gmail.com>
parents: 3478
diff changeset
1271 /* aim:goim?screenname=screenname&message=message */
84df15473af6 [gaim-migrate @ 3533]
Sean Egan <seanegan@gmail.com>
parents: 3478
diff changeset
1272 if (!g_strncasecmp(uri, "aim:goim?", strlen("aim:goim?"))) {
3478
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1273 char *who, *what;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1274 struct conversation *c;
3479
84df15473af6 [gaim-migrate @ 3533]
Sean Egan <seanegan@gmail.com>
parents: 3478
diff changeset
1275 uri = uri + strlen("aim:goim?");
3478
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1276
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1277 if (!(who = strstr(uri, "screenname="))) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1278 return "No screenname given.";
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1279 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1280 /* spaces are encoded as +'s */
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1281 who = who + strlen("screenname=");
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1282 str = g_string_new(NULL);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1283 while (*who && (*who != '&')) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1284 g_string_append_c(str, *who == '+' ? ' ' : *who);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1285 who++;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1286 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1287 who = g_strdup(str->str);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1288 g_string_free(str, TRUE);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1289
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1290 what = strstr(uri, "message=");
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1291 if (what) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1292 what = what + strlen("message=");
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1293 str = g_string_new(NULL);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1294 while (*what && (*what != '&' || !g_strncasecmp(what, "&amp;", 5))) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1295 g_string_append_c(str, *what == '+' ? ' ' : *what);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1296 what++;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1297 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1298 what = g_strdup(str->str);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1299 g_string_free(str, TRUE);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1300 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1301
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1302 c = new_conversation(who);
3530
f38516e5d1ab [gaim-migrate @ 3603]
Sean Egan <seanegan@gmail.com>
parents: 3479
diff changeset
1303 set_convo_gc(c, gc);
3478
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1304 g_free(who);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1305 if (what) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1306 int finish;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1307 gtk_editable_insert_text(GTK_EDITABLE(c->entry),
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1308 what, strlen(what), &finish);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1309 g_free(what);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1310 }
3479
84df15473af6 [gaim-migrate @ 3533]
Sean Egan <seanegan@gmail.com>
parents: 3478
diff changeset
1311 } else if (!g_strncasecmp(uri, "aim:addbuddy?", strlen("aim:addbuddy?"))) {
3478
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1312 char *who, *group;
3479
84df15473af6 [gaim-migrate @ 3533]
Sean Egan <seanegan@gmail.com>
parents: 3478
diff changeset
1313 uri = uri + strlen("aim:addbuddy?");
3478
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1314 /* spaces are encoded as +'s */
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1315
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1316 if (!(who = strstr(uri, "screenname="))) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1317 return "No screenname given.";
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1318 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1319 who = who + strlen("screenname=");
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1320 str = g_string_new(NULL);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1321 while (*who && (*who != '&')) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1322 g_string_append_c(str, *who == '+' ? ' ' : *who);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1323 who++;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1324 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1325 who = g_strdup(str->str);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1326 g_string_free(str, TRUE);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1327
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1328 group = strstr(uri, "group=");
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1329 if (group) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1330 group = group + strlen("group=");
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1331 str = g_string_new(NULL);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1332 while (*group && (*group != '&' || !g_strncasecmp(group, "&amp;", 5))) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1333 g_string_append_c(str, *group == '+' ? ' ' : *group);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1334 group++;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1335 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1336 group = g_strdup(str->str);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1337 g_string_free(str, TRUE);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1338 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1339 debug_printf("who: %s\n", who);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1340 show_add_buddy(gc, who, group, NULL);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1341 g_free(who);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1342 if (group)
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1343 g_free(group);
3479
84df15473af6 [gaim-migrate @ 3533]
Sean Egan <seanegan@gmail.com>
parents: 3478
diff changeset
1344 } else if (!g_strncasecmp(uri, "aim:gochat?", strlen("aim:gochat?"))) {
3478
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1345 char *room;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1346 GList *chat=NULL;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1347 int exch = 5;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1348
3479
84df15473af6 [gaim-migrate @ 3533]
Sean Egan <seanegan@gmail.com>
parents: 3478
diff changeset
1349 uri = uri + strlen("aim:gochat?");
3478
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1350 /* spaces are encoded as +'s */
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1351
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1352 if (!(room = strstr(uri, "roomname="))) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1353 return "No roomname given.";
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1354 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1355 room = room + strlen("roomname=");
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1356 str = g_string_new(NULL);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1357 while (*room && (*room != '&')) {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1358 g_string_append_c(str, *room == '+' ? ' ' : *room);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1359 room++;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1360 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1361 room = g_strdup(str->str);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1362 g_string_free(str, TRUE);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1363 chat = g_list_append(NULL, room);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1364 chat = g_list_append(chat, &exch);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1365 serv_join_chat(gc, chat);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1366 g_free(room);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1367 g_list_free(chat);
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1368 } else {
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1369 return "Invalid AIM URI";
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1370 }
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1371
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1372
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1373 return NULL;
3da42b64304e [gaim-migrate @ 3532]
Sean Egan <seanegan@gmail.com>
parents: 3474
diff changeset
1374 }
3649
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1375
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1376 GtkWidget *gaim_pixmap(char *subdir, char *iconfile) {
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1377 char *filename;
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1378 GtkWidget *image;
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1379
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1380 if (subdir != NULL)
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1381 filename = g_build_filename (DATADIR, "pixmaps", "gaim", subdir, iconfile, NULL);
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1382 else
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1383 filename = g_build_filename (DATADIR, "pixmaps", "gaim", iconfile, NULL);
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1384
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1385 debug_printf("Loading: %s\n", filename);
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1386
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1387 image = gtk_image_new_from_file(filename);
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1388
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1389 g_free(filename);
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1390
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1391 return image;
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1392 }
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1393
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1394 GdkPixbuf *gaim_pixbuf(char *subdir, char *iconfile) {
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1395 char *filename;
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1396 GdkPixbuf *pixbuf;
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1397 GError *err = NULL;
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1398
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1399 if (subdir != NULL)
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1400 filename = g_build_filename (DATADIR, "pixmaps", "gaim", subdir, iconfile, NULL);
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1401 else
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1402 filename = g_build_filename (DATADIR, "pixmaps", "gaim", iconfile, NULL);
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1403
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1404 debug_printf("Loading: %s\n", filename);
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1405
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1406 pixbuf = gdk_pixbuf_new_from_file(filename, &err);
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1407 if (!pixbuf) {
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1408 /* FIXME: Maybe we should handle this error */
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1409 g_error_free(err);
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1410 }
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1411
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1412 g_free(filename);
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1413
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1414 return pixbuf;
f09193608fd3 [gaim-migrate @ 3773]
Rob Flynn <gaim@robflynn.com>
parents: 3642
diff changeset
1415 }
3668
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1416
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1417 GtkWidget *gaim_new_item_from_stock(GtkWidget *menu, const char *str, const char *icon, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod)
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1418 {
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1419 GtkWidget *menuitem;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1420 GtkWidget *hbox;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1421 GtkWidget *label;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1422 GtkWidget *image;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1423
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1424 if (icon == NULL)
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1425 menuitem = gtk_menu_item_new_with_mnemonic(_(str));
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1426 else
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1427 menuitem = gtk_image_menu_item_new_with_mnemonic(_(str));
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1428
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1429 if (menu)
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1430 gtk_menu_append(GTK_MENU(menu), menuitem);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1431
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1432 if (sf)
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1433 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", sf, data);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1434
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1435 if (icon != NULL) {
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1436 image = gtk_image_new_from_stock(icon, GTK_ICON_SIZE_MENU);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1437 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1438 }
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1439
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1440 if (mod) {
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1441 label = gtk_label_new(mod);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1442 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 2);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1443 gtk_widget_show(label);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1444 }
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1445 /*
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1446 if (accel_key) {
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1447 gtk_widget_add_accelerator(menuitem, "activate", accel, accel_key,
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1448 accel_mods, GTK_ACCEL_LOCKED);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1449 }
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1450 */
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1451
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1452 gtk_widget_show_all(menuitem);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1453
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1454 return menuitem;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1455 }
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1456
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1457 GtkWidget *gaim_new_item_from_pixbuf(GtkWidget *menu, const char *str, char *iconname, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod)
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1458 {
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1459 GtkWidget *menuitem;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1460 GtkWidget *hbox;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1461 GtkWidget *label;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1462 GtkWidget *image;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1463
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1464 if (iconname == NULL)
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1465 menuitem = gtk_menu_item_new_with_mnemonic(_(str));
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1466 else
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1467 menuitem = gtk_image_menu_item_new_with_mnemonic(_(str));
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1468
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1469 if (menu)
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1470 gtk_menu_append(GTK_MENU(menu), menuitem);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1471
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1472 if (sf)
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1473 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", sf, data);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1474
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1475 if (iconname != NULL) {
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1476 char *filename;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1477
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1478 filename = g_build_filename (DATADIR, "pixmaps", "gaim", "menus", iconname, NULL);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1479 debug_printf("Loading: %s\n", filename);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1480 image = gtk_image_new_from_file(filename);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1481 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1482 g_free(filename);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1483 }
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1484
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1485 if (mod) {
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1486 label = gtk_label_new(mod);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1487 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 2);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1488 gtk_widget_show(label);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1489 }
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1490 /*
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1491 if (accel_key) {
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1492 gtk_widget_add_accelerator(menuitem, "activate", accel, accel_key,
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1493 accel_mods, GTK_ACCEL_LOCKED);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1494 }
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1495 */
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1496
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1497 gtk_widget_show_all(menuitem);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1498
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1499 return menuitem;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1500 }
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1501
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1502
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1503 GtkWidget *gaim_new_item_with_pixmap(GtkWidget *menu, const char *str, char **xpm, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod)
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1504 {
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1505 GtkWidget *menuitem;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1506 GtkWidget *hbox;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1507 GtkWidget *label;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1508 GtkWidget *pixmap;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1509 GdkPixmap *pm;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1510 GdkBitmap *mask;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1511
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1512 menuitem = gtk_menu_item_new();
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1513 if (menu)
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1514 gtk_menu_append(GTK_MENU(menu), menuitem);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1515 if (sf)
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1516 /* passing 1 is necessary so if we sign off closing the account editor doesn't exit */
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1517 gtk_signal_connect(GTK_OBJECT(menuitem), "activate", sf, data);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1518 gtk_widget_show(menuitem);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1519
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1520 /* Create our container */
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1521 hbox = gtk_hbox_new(FALSE, 2);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1522 gtk_container_add(GTK_CONTAINER(menuitem), hbox);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1523 gtk_widget_show(hbox);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1524
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1525 /* Create our pixmap and pack it */
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1526 gtk_widget_realize(menu->parent);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1527 pm = gdk_pixmap_create_from_xpm_d(menu->parent->window, &mask, NULL, xpm);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1528 pixmap = gtk_pixmap_new(pm, mask);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1529 gtk_widget_show(pixmap);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1530 gdk_pixmap_unref(pm);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1531 gdk_bitmap_unref(mask);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1532 gtk_box_pack_start(GTK_BOX(hbox), pixmap, FALSE, FALSE, 2);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1533
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1534 /* Create our label and pack it */
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1535 label = gtk_label_new(str);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1536 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1537 gtk_widget_show(label);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1538
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1539 if (mod) {
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1540 label = gtk_label_new(mod);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1541 gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 2);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1542 gtk_widget_show(label);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1543 }
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1544 /*
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1545 if (accel_key) {
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1546 gtk_widget_add_accelerator(menuitem, "activate", accel, accel_key,
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1547 accel_mods, GTK_ACCEL_LOCKED);
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1548 }
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1549 */
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1550 return menuitem;
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1551 }
5b82f99d028d [gaim-migrate @ 3798]
Rob Flynn <gaim@robflynn.com>
parents: 3649
diff changeset
1552
3698
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1553 GtkWidget *gaim_new_item(GtkWidget *menu, const char *str)
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1554 {
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1555 GtkWidget *menuitem;
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1556 GtkWidget *label;
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1557
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1558 menuitem = gtk_menu_item_new();
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1559 if (menu)
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1560 gtk_menu_append(GTK_MENU(menu), menuitem);
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1561 gtk_widget_show(menuitem);
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1562
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1563 label = gtk_label_new(str);
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1564 gtk_label_set_pattern(GTK_LABEL(label), "_");
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1565 gtk_container_add(GTK_CONTAINER(menuitem), label);
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1566 gtk_widget_show(label);
3699
b401bd1701b4 [gaim-migrate @ 3830]
Rob Flynn <gaim@robflynn.com>
parents: 3698
diff changeset
1567 /* FIXME: Go back and fix this
3698
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1568 gtk_widget_add_accelerator(menuitem, "activate", accel, str[0],
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1569 GDK_MOD1_MASK, GTK_ACCEL_LOCKED);
3699
b401bd1701b4 [gaim-migrate @ 3830]
Rob Flynn <gaim@robflynn.com>
parents: 3698
diff changeset
1570 */
3698
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1571 return menuitem;
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1572 }
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1573
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1574
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1575
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1576
507eb0a2c7b2 [gaim-migrate @ 3829]
Rob Flynn <gaim@robflynn.com>
parents: 3668
diff changeset
1577