1
|
1 /*
|
|
2 * gaim
|
|
3 *
|
|
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
|
|
5 *
|
|
6 * This program is free software; you can redistribute it and/or modify
|
|
7 * it under the terms of the GNU General Public License as published by
|
|
8 * the Free Software Foundation; either version 2 of the License, or
|
|
9 * (at your option) any later version.
|
|
10 *
|
|
11 * This program is distributed in the hope that it will be useful,
|
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 * GNU General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU General Public License
|
|
17 * along with this program; if not, write to the Free Software
|
|
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 *
|
|
20 */
|
|
21
|
|
22 #include <unistd.h>
|
|
23 #include <errno.h>
|
|
24 #include <stdio.h>
|
|
25 #include <stdlib.h>
|
|
26 #include <sys/time.h>
|
|
27 #include <sys/types.h>
|
|
28 #include <sys/stat.h>
|
|
29 #include <string.h>
|
|
30 #include <sys/wait.h>
|
|
31 #include <gtk/gtk.h>
|
|
32 #include <pixmaps/aimicon.xpm>
|
|
33 #include "gaim.h"
|
|
34
|
|
35 static GdkPixmap *icon_pm = NULL;
|
|
36 static GdkBitmap *icon_bm = NULL;
|
|
37 static int state;
|
|
38
|
|
39 gint badchar(char c)
|
|
40 {
|
|
41 if (c == ' ')
|
|
42 return 1;
|
|
43 if (c == ',')
|
|
44 return 1;
|
|
45 if (c == ')')
|
|
46 return 1;
|
|
47 if (c == '(')
|
|
48 return 1;
|
|
49 if (c == 0)
|
|
50 return 1;
|
|
51 if (c == '\n')
|
|
52 return 1;
|
|
53 return 0;
|
|
54
|
|
55
|
|
56 }
|
|
57
|
|
58
|
|
59 char *sec_to_text(int sec)
|
|
60 {
|
|
61 int hrs, min;
|
|
62 char minutes[64];
|
|
63 char hours[64];
|
|
64 char sep[16];
|
|
65 char *ret = g_malloc(256);
|
|
66
|
|
67 hrs = sec / 3600;
|
|
68 min = sec % 3600;
|
|
69
|
|
70 min = min / 60;
|
|
71 sec = min % 60;
|
|
72
|
|
73 if (min) {
|
|
74 if (min == 1)
|
|
75 g_snprintf(minutes, sizeof(minutes), "%d minute.", min);
|
|
76 else
|
|
77 g_snprintf(minutes, sizeof(minutes), "%d minutes.", min);
|
|
78 sprintf(sep, ", ");
|
|
79 } else {
|
|
80 if (!hrs)
|
|
81 g_snprintf(minutes, sizeof(minutes), "%d minutes.", min);
|
|
82 else {
|
|
83 minutes[0] = '.';
|
|
84 minutes[1] = '\0';
|
|
85 }
|
|
86 sep[0] = '\0';
|
|
87 }
|
|
88
|
|
89 if (hrs) {
|
|
90 if (hrs == 1)
|
|
91 g_snprintf(hours, sizeof(hours), "%d hour%s", hrs, sep);
|
|
92 else
|
|
93 g_snprintf(hours, sizeof(hours), "%d hours%s", hrs, sep);
|
|
94 } else
|
|
95 hours[0] = '\0';
|
|
96
|
|
97
|
|
98 g_snprintf(ret, 256, "%s%s", hours, minutes);
|
|
99
|
|
100 return ret;
|
|
101 }
|
|
102
|
|
103 gint linkify_text(char *text)
|
|
104 {
|
|
105 char *c, *t;
|
|
106 char cpy[BUF_LONG];
|
|
107 char url_buf[512];
|
|
108 int cnt=0;
|
|
109 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
|
|
110
|
|
111 strncpy(cpy, text, strlen(text));
|
|
112 cpy[strlen(text)] = 0;
|
|
113 c = cpy;
|
|
114 while(*c) {
|
|
115 if (!strncasecmp(c, "<A", 2)) {
|
|
116 while(1) {
|
|
117 if (!strncasecmp(c, "/A>", 3)) {
|
|
118 break;
|
|
119 }
|
|
120 text[cnt++] = *c;
|
|
121 c++;
|
|
122 if (!(*c))
|
|
123 break;
|
|
124 }
|
|
125 } else if (!strncasecmp(c, "http://", 7)) {
|
|
126 t = c;
|
|
127 while(1) {
|
|
128 if (badchar(*t)) {
|
|
129 if (*(t-1) == '.')
|
|
130 t--;
|
|
131 strncpy(url_buf, c, t-c);
|
|
132 url_buf[t-c] = 0;
|
|
133 cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"%s\">%s</A>", url_buf, url_buf);
|
|
134 cnt--;
|
|
135 c = t;
|
|
136 break;
|
|
137 }
|
|
138 if (!t)
|
|
139 break;
|
|
140 t++;
|
|
141
|
|
142 }
|
|
143 } else if (!strncasecmp(c, "www.", 4)) {
|
|
144 if (strncasecmp(c, "www..", 5)) {
|
|
145 t = c;
|
|
146 while(1) {
|
|
147 if (badchar(*t)) {
|
|
148 if (t-c == 4) {
|
|
149 break;
|
|
150 }
|
|
151 if (*(t-1) == '.')
|
|
152 t--;
|
|
153 strncpy(url_buf, c, t-c);
|
|
154 url_buf[t-c] = 0;
|
|
155 cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"http://%s\">%s</A>", url_buf, url_buf);
|
|
156 cnt--;
|
|
157 c = t;
|
|
158 break;
|
|
159 }
|
|
160 if (!t)
|
|
161 break;
|
|
162 t++;
|
|
163 }
|
|
164 }
|
|
165 } else if (!strncasecmp(c, "ftp://", 6)) {
|
|
166 t = c;
|
|
167 while(1) {
|
|
168 if (badchar(*t)) {
|
|
169 if (*(t-1) == '.')
|
|
170 t--;
|
|
171 strncpy(url_buf, c, t-c);
|
|
172 url_buf[t-c] = 0;
|
|
173 cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"%s\">%s</A>", url_buf, url_buf);
|
|
174 cnt--;
|
|
175 c = t;
|
|
176 break;
|
|
177 }
|
|
178 if (!t)
|
|
179 break;
|
|
180 t++;
|
|
181
|
|
182 }
|
|
183 } else if (!strncasecmp(c, "ftp.", 4)) {
|
|
184 t = c;
|
|
185 while(1) {
|
|
186 if (badchar(*t)) {
|
|
187 if (t-c == 4) {
|
|
188 break;
|
|
189 }
|
|
190 if (*(t-1) == '.')
|
|
191 t--;
|
|
192 strncpy(url_buf, c, t-c);
|
|
193 url_buf[t-c] = 0;
|
|
194 cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"ftp://%s\">%s</A>", url_buf, url_buf);
|
|
195 cnt--;
|
|
196 c = t;
|
|
197 break;
|
|
198 }
|
|
199 if (!t)
|
|
200 break;
|
|
201 t++;
|
|
202 }
|
|
203 } else if (!strncasecmp(c, "mailto:", 7)) {
|
|
204 t = c;
|
|
205 while(1) {
|
|
206 if (badchar(*t)) {
|
|
207 if (*(t-1) == '.')
|
|
208 t--;
|
|
209 strncpy(url_buf, c, t-c);
|
|
210 url_buf[t-c] = 0;
|
|
211 cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"%s\">%s</A>", url_buf, url_buf);
|
|
212 cnt--;
|
|
213 c = t;
|
|
214 break;
|
|
215 }
|
|
216 if (!t)
|
|
217 break;
|
|
218 t++;
|
|
219
|
|
220 }
|
|
221 } else if (!strncasecmp(c, "@", 1)) {
|
|
222 char *tmp;
|
|
223 int flag;
|
|
224 int len=0;
|
|
225 url_buf[0] = 0;
|
|
226
|
|
227 if (*(c-1) == ' ' || *(c+1) == ' ')
|
|
228 flag = 0;
|
|
229 else
|
|
230 flag = 1;
|
|
231
|
|
232 t = c;
|
|
233 while(flag) {
|
|
234 if (badchar(*t)) {
|
|
235 cnt -= (len - 1);
|
|
236 break;
|
|
237 } else {
|
|
238 len++;
|
|
239 tmp = g_malloc(len + 1);
|
|
240 tmp[len] = 0;
|
|
241 tmp[0] = *t;
|
|
242 strncpy(tmp + 1, url_buf, len - 1);
|
|
243 strcpy(url_buf, tmp);
|
|
244 url_buf[len] = 0;
|
|
245 g_free(tmp);
|
|
246 t--;
|
|
247 if (t < cpy) {
|
|
248 cnt = 0;
|
|
249 break;
|
|
250 }
|
|
251 }
|
|
252 }
|
|
253
|
|
254
|
|
255 t = c + 1;
|
|
256
|
|
257 while(flag) {
|
|
258 if (badchar(*t)) {
|
|
259 if (*(t-1) == '.')
|
|
260 t--;
|
|
261 cnt += g_snprintf(&text[cnt++], 1024, "<A HREF=\"mailto:%s\">%s</A>", url_buf, url_buf);
|
|
262 text[cnt]=0;
|
|
263
|
|
264
|
|
265 cnt--;
|
|
266 c = t;
|
|
267
|
|
268 break;
|
|
269 } else {
|
|
270 strncat(url_buf, t, 1);
|
|
271 len++;
|
|
272 url_buf[len] = 0;
|
|
273 }
|
|
274
|
|
275 t++;
|
|
276
|
|
277 }
|
|
278
|
|
279
|
|
280 }
|
|
281
|
|
282 if (*c == 0)
|
|
283 break;
|
|
284
|
|
285 text[cnt++] = *c;
|
|
286 c++;
|
|
287
|
|
288 }
|
|
289 text[cnt]=0;
|
|
290 return cnt;
|
|
291 }
|
|
292
|
|
293
|
|
294 FILE *open_log_file (struct conversation *c)
|
|
295 {
|
|
296 char *buf = g_malloc(BUF_LONG);
|
|
297 char *buf2 = g_malloc(BUF_LONG);
|
|
298 char log_all_file[256];
|
|
299 struct log_conversation *l;
|
|
300 struct stat st;
|
|
301 int flag = 0;
|
|
302 FILE *fd;
|
|
303 int res;
|
|
304
|
|
305 if (!(general_options & OPT_GEN_LOG_ALL)) {
|
|
306
|
25
|
307 g_free(buf);
|
|
308 g_free(buf2);
|
|
309
|
1
|
310 l = find_log_info(c->name);
|
|
311 if (!l)
|
|
312 return NULL;
|
|
313
|
|
314 if (stat(l->filename, &st) < 0)
|
|
315 flag = 1;
|
|
316
|
|
317 fd = fopen(l->filename, "a");
|
|
318
|
|
319 if (flag) { /* is a new file */
|
|
320 fprintf(fd, "<HTML><HEAD><TITLE>" );
|
|
321 fprintf(fd, "IM Sessions with %s", c->name );
|
|
322 fprintf(fd, "</TITLE></HEAD><BODY BGCOLOR=\"ffffff\">\n" );
|
|
323 }
|
|
324
|
|
325 return fd;
|
|
326 }
|
|
327
|
|
328 /* Dont log yourself */
|
|
329 g_snprintf(log_all_file, 256, "%s/.gaim", getenv("HOME"));
|
|
330
|
|
331 stat(log_all_file, &st);
|
|
332 if (!S_ISDIR(st.st_mode))
|
|
333 unlink(log_all_file);
|
|
334
|
|
335 fd = fopen(log_all_file, "r");
|
|
336
|
|
337 if (!fd) {
|
|
338 res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR);
|
|
339 if (res < 0) {
|
|
340 g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging", log_all_file);
|
|
341 do_error_dialog(buf, "Error!");
|
|
342 g_free(buf);
|
|
343 g_free(buf2);
|
|
344 return NULL;
|
|
345 }
|
|
346 } else
|
|
347 fclose(fd);
|
|
348
|
|
349 g_snprintf(log_all_file, 256, "%s/.gaim/%s", getenv("HOME"), current_user->username);
|
|
350
|
|
351 if (stat(log_all_file, &st) < 0)
|
|
352 flag = 1;
|
|
353 if (!S_ISDIR(st.st_mode))
|
|
354 unlink(log_all_file);
|
|
355
|
|
356 fd = fopen(log_all_file, "r");
|
|
357 if (!fd) {
|
|
358 res = mkdir(log_all_file, S_IRUSR | S_IWUSR | S_IXUSR);
|
|
359 if (res < 0) {
|
|
360 g_snprintf(buf, BUF_LONG, "Unable to make directory %s for logging", log_all_file);
|
|
361 do_error_dialog(buf, "Error!");
|
|
362 g_free(buf);
|
|
363 g_free(buf2);
|
|
364 return NULL;
|
|
365 }
|
|
366 } else
|
|
367 fclose(fd);
|
|
368
|
|
369
|
|
370 g_snprintf(log_all_file, 256, "%s/.gaim/%s/%s.log", getenv("HOME"), current_user->username, normalize(c->name));
|
|
371
|
|
372 if (stat(log_all_file, &st) < 0)
|
|
373 flag = 1;
|
|
374
|
|
375 sprintf(debug_buff,"Logging to: \"%s\"\n", log_all_file);
|
|
376 debug_print(debug_buff);
|
|
377
|
|
378 fd = fopen(log_all_file, "a");
|
|
379
|
|
380 if (flag) { /* is a new file */
|
|
381 fprintf(fd, "<HTML><HEAD><TITLE>" );
|
|
382 fprintf(fd, "IM Sessions with %s", c->name );
|
|
383 fprintf(fd, "</TITLE></HEAD><BODY BGCOLOR=\"ffffff\">\n" );
|
|
384 }
|
25
|
385
|
|
386 g_free(buf);
|
|
387 g_free(buf2);
|
1
|
388 return fd;
|
|
389 }
|
|
390
|
|
391
|
|
392 int escape_message(char *msg)
|
|
393 {
|
|
394 char *c, *cpy;
|
|
395 int cnt=0;
|
|
396 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
|
|
397 if (strlen(msg) > BUF_LEN) {
|
|
398 sprintf(debug_buff, "Warning: truncating message to 2048 bytes\n");
|
|
399 debug_print(debug_buff);
|
|
400 msg[2047]='\0';
|
|
401 }
|
|
402
|
|
403 cpy = g_strdup(msg);
|
|
404 c = cpy;
|
|
405 while(*c) {
|
|
406 switch(*c) {
|
|
407 case '$':
|
|
408 case '[':
|
|
409 case ']':
|
|
410 case '(':
|
|
411 case ')':
|
|
412 case '#':
|
|
413 msg[cnt++]='\\';
|
|
414 /* Fall through */
|
|
415 default:
|
|
416 msg[cnt++]=*c;
|
|
417 }
|
|
418 c++;
|
|
419 }
|
|
420 msg[cnt]='\0';
|
|
421 g_free(cpy);
|
|
422 return cnt;
|
|
423 }
|
|
424
|
|
425 int escape_text(char *msg)
|
|
426 {
|
|
427 char *c, *cpy;
|
|
428 int cnt=0;
|
|
429 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
|
|
430 if (strlen(msg) > BUF_LEN) {
|
|
431 fprintf(stderr, "Warning: truncating message to 2048 bytes\n");
|
|
432 msg[2047]='\0';
|
|
433 }
|
|
434
|
|
435 cpy = g_strdup(msg);
|
|
436 c = cpy;
|
|
437 while(*c) {
|
|
438 switch(*c) {
|
|
439 case '\n':
|
|
440 msg[cnt++] = '<';
|
|
441 msg[cnt++] = 'B';
|
|
442 msg[cnt++] = 'R';
|
|
443 msg[cnt++] = '>';
|
|
444 break;
|
|
445 case '{':
|
|
446 case '}':
|
|
447 case '\\':
|
|
448 case '"':
|
|
449 msg[cnt++]='\\';
|
|
450 /* Fall through */
|
|
451 default:
|
|
452 msg[cnt++]=*c;
|
|
453 }
|
|
454 c++;
|
|
455 }
|
|
456 msg[cnt]='\0';
|
|
457 g_free(cpy);
|
|
458 return cnt;
|
|
459 }
|
|
460
|
|
461 char * escape_text2(char *msg)
|
|
462 {
|
|
463 char *c, *cpy;
|
|
464 char *woo;
|
|
465 int cnt=0;
|
|
466 /* Assumes you have a buffer able to cary at least BUF_LEN * 2 bytes */
|
|
467 if (strlen(msg) > BUF_LEN) {
|
|
468 fprintf(stderr, "Warning: truncating message to 2048 bytes\n");
|
|
469 msg[2047]='\0';
|
|
470 }
|
|
471
|
|
472 woo = (char *)malloc(strlen(msg) * 2);
|
|
473 cpy = g_strdup(msg);
|
|
474 c = cpy;
|
|
475 while(*c) {
|
|
476 switch(*c) {
|
|
477 case '\n':
|
|
478 woo[cnt++] = '<';
|
|
479 woo[cnt++] = 'B';
|
|
480 woo[cnt++] = 'R';
|
|
481 woo[cnt++] = '>';
|
|
482 break;
|
|
483 case '{':
|
|
484 case '}':
|
|
485 case '\\':
|
|
486 case '"':
|
|
487 woo[cnt++]='\\';
|
|
488 /* Fall through */
|
|
489 default:
|
|
490 woo[cnt++]=*c;
|
|
491 }
|
|
492 c++;
|
|
493 }
|
|
494 woo[cnt]='\0';
|
|
495 return woo;
|
|
496 }
|
|
497
|
|
498
|
|
499 char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
|
500 "0123456789+/";
|
|
501
|
|
502
|
|
503 char *tobase64(char *text)
|
|
504 {
|
|
505 char *out = NULL;
|
|
506 char *c;
|
|
507 unsigned int tmp = 0;
|
|
508 int len = 0, n = 0;
|
|
509
|
|
510 c = text;
|
|
511
|
|
512 while(c) {
|
|
513 tmp = tmp << 8;
|
|
514 tmp += *c;
|
|
515 n++;
|
|
516
|
|
517 if (n == 3) {
|
|
518 out = g_realloc(out, len+4);
|
|
519 out[len] = alphabet[(tmp >> 18) & 0x3f];
|
|
520 out[len+1] = alphabet[(tmp >> 12) & 0x3f];
|
|
521 out[len+2] = alphabet[(tmp >> 6) & 0x3f];
|
|
522 out[len+3] = alphabet[tmp & 0x3f];
|
|
523 len += 4;
|
|
524 tmp = 0;
|
|
525 n = 0;
|
|
526 }
|
|
527 c++;
|
|
528 }
|
|
529 switch(n) {
|
|
530
|
|
531 case 2:
|
|
532 out = g_realloc(out, len+5);
|
|
533 out[len] = alphabet[(tmp >> 12) & 0x3f];
|
|
534 out[len+1] = alphabet[(tmp >> 6) & 0x3f];
|
|
535 out[len+2] = alphabet[tmp & 0x3f];
|
|
536 out[len+3] = '=';
|
|
537 out[len+4] = 0;
|
|
538 break;
|
|
539 case 1:
|
|
540 out = g_realloc(out, len+4);
|
|
541 out[len] = alphabet[(tmp >> 6) & 0x3f];
|
|
542 out[len+1] = alphabet[tmp & 0x3f];
|
|
543 out[len+2] = '=';
|
|
544 out[len+3] = 0;
|
|
545 break;
|
|
546 case 0:
|
|
547 out = g_realloc(out, len+2);
|
|
548 out[len] = '=';
|
|
549 out[len+1] = 0;
|
|
550 break;
|
|
551 }
|
|
552 return out;
|
|
553 }
|
|
554
|
|
555
|
|
556 char *frombase64(char *text)
|
|
557 {
|
|
558 char *out = NULL;
|
|
559 char tmp = 0;
|
|
560 char *c;
|
|
561 gint32 tmp2 = 0;
|
|
562 int len = 0, n = 0;
|
|
563
|
|
564 c = text;
|
|
565
|
|
566 while(*c) {
|
|
567 if (*c >= 'A' && *c <= 'Z') {
|
|
568 tmp = *c - 'A';
|
|
569 } else if (*c >= 'a' && *c <= 'z') {
|
|
570 tmp = 26 + (*c - 'a');
|
|
571 } else if (*c >= '0' && *c <= 57) {
|
|
572 tmp = 52 + (*c - '0');
|
|
573 } else if (*c == '+') {
|
|
574 tmp = 62;
|
|
575 } else if (*c == '/') {
|
|
576 tmp = 63;
|
|
577 } else if (*c == '=') {
|
|
578 if (n == 3) {
|
|
579 out = g_realloc(out, len + 2);
|
|
580 out[len] = (char)(tmp2 >> 10) & 0xff;
|
|
581 len++;
|
|
582 out[len] = (char)(tmp2 >> 2) & 0xff;
|
|
583 len++;
|
|
584 } else if (n == 2) {
|
|
585 out = g_realloc(out, len + 1);
|
|
586 out[len] = (char)(tmp2 >> 4) & 0xff;
|
|
587 len++;
|
|
588 }
|
|
589 break;
|
|
590 }
|
|
591 tmp2 = ((tmp2 << 6) | (tmp & 0xff));
|
|
592 n++;
|
|
593 if (n == 4) {
|
|
594 out = g_realloc(out, len + 3);
|
|
595 out[len] = (char)((tmp2 >> 16) & 0xff);
|
|
596 len++;
|
|
597 out[len] = (char)((tmp2 >> 8) & 0xff);
|
|
598 len++;
|
|
599 out[len] = (char)(tmp2 & 0xff);
|
|
600 len++;
|
|
601 tmp2 = 0;
|
|
602 n = 0;
|
|
603 }
|
|
604 c++;
|
|
605 }
|
|
606
|
|
607 g_realloc(out, len+1);
|
|
608 out[len] = 0;
|
|
609
|
|
610 return out;
|
|
611 }
|
|
612
|
|
613
|
|
614 char *normalize(const char *s)
|
|
615 {
|
|
616 static char buf[BUF_LEN];
|
|
617 char *t, *u;
|
|
618 int x=0;
|
|
619
|
|
620 u = t = g_malloc(strlen(s) + 1);
|
|
621
|
|
622 strcpy(t, s);
|
|
623 g_strdown(t);
|
|
624
|
|
625 while(*t) {
|
|
626 if (*t != ' ') {
|
|
627 buf[x] = *t;
|
|
628 x++;
|
|
629 }
|
|
630 t++;
|
|
631 }
|
|
632 buf[x]='\0';
|
|
633 g_free(u);
|
|
634 return buf;
|
|
635 }
|
|
636
|
|
637 int query_state()
|
|
638 {
|
|
639 return state;
|
|
640 }
|
|
641
|
|
642 void set_state(int i)
|
|
643 {
|
|
644 state = i;
|
|
645 }
|
|
646
|
|
647 char *date()
|
|
648 {
|
|
649 static char date[80];
|
|
650 time_t tme;
|
|
651 time(&tme);
|
|
652 strftime(date, sizeof(date), "%H:%M:%S", localtime(&tme));
|
|
653 return date;
|
|
654 }
|
|
655
|
|
656
|
|
657 gint clean_pid(void *dummy)
|
|
658 {
|
|
659 int status;
|
|
660 pid_t pid;
|
|
661
|
|
662 pid = waitpid(-1, &status, WNOHANG);
|
|
663
|
|
664 if (pid == 0)
|
|
665 return TRUE;
|
|
666
|
|
667 return FALSE;
|
|
668 }
|
|
669
|
|
670 void aol_icon(GdkWindow *w)
|
|
671 {
|
|
672 #ifndef _WIN32
|
|
673 if (icon_pm == NULL) {
|
|
674 icon_pm = gdk_pixmap_create_from_xpm_d(w, &icon_bm,
|
|
675 NULL, (gchar **)aimicon_xpm);
|
|
676 }
|
|
677 gdk_window_set_icon(w, NULL, icon_pm, icon_bm);
|
10
|
678 if (mainwindow) gdk_window_set_group(w, mainwindow->window);
|
1
|
679 #endif
|
|
680 }
|
|
681
|
|
682 struct aim_user *find_user(const char *name)
|
|
683 {
|
|
684 char *who = g_strdup(normalize(name));
|
|
685 GList *usr = aim_users;
|
|
686 struct aim_user *u;
|
|
687
|
|
688 while(usr) {
|
|
689 u = (struct aim_user *)usr->data;
|
|
690 if (!strcmp(normalize(u->username), who)) {
|
|
691 g_free(who);
|
|
692 return u;
|
|
693 }
|
|
694 usr = usr->next;
|
|
695 }
|
|
696 g_free(who);
|
|
697 return NULL;
|
|
698 }
|