Mercurial > pidgin
annotate libpurple/protocols/oscar/util.c @ 30362:879baaf87aa2
Added an error handler for family_icq.c. So far it works for
icq fullinfo and alias requests.
This was originally motivated by me getting "Server rate limit exceeded"
while testing authorization requests. This error completely prevented
the authorization request dialog from showing up.
author | ivan.komarov@soc.pidgin.im |
---|---|
date | Sun, 30 May 2010 19:01:30 +0000 |
parents | 9881f18b95b1 |
children | a1043e95aa13 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15822 | 2 * Purple's oscar protocol plugin |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * This file is the legal property of its developers. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 * Please see the AUTHORS file distributed alongside this file. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * This library is free software; you can redistribute it and/or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * License as published by the Free Software Foundation; either |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * version 2 of the License, or (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * This library is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * Lesser General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * License along with this library; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19642
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 * A little bit of this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 * A little bit of that |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 * It started with a kiss |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 * Now we're up to bat |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "oscar.h" |
27427
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
29 |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
30 #include "core.h" |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
31 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include <ctype.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #ifdef _WIN32 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "win32dep.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
29986
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
38 static const char * const msgerrreason[] = { |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
39 N_("Invalid error"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
40 N_("Invalid SNAC"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
41 N_("Rate to host"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
42 N_("Rate to client"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
43 N_("Not logged in"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
44 N_("Service unavailable"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
45 N_("Service not defined"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
46 N_("Obsolete SNAC"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
47 N_("Not supported by host"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
48 N_("Not supported by client"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
49 N_("Refused by client"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
50 N_("Reply too big"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
51 N_("Responses lost"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
52 N_("Request denied"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
53 N_("Busted SNAC payload"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
54 N_("Insufficient rights"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
55 N_("In local permit/deny"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
56 N_("Warning level too high (sender)"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
57 N_("Warning level too high (receiver)"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
58 N_("User temporarily unavailable"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
59 N_("No match"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
60 N_("List overflow"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
61 N_("Request ambiguous"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
62 N_("Queue full"), |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
63 N_("Not while on AOL") |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
64 }; |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
65 static const int msgerrreasonlen = G_N_ELEMENTS(msgerrreason); |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
66 |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
67 const char *oscar_get_msgerr_reason(size_t reason) |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
68 { |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
69 return (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason"); |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
70 } |
f18b6eb0ed02
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <mark@kingant.net>
parents:
27429
diff
changeset
|
71 |
27428
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
72 int oscar_get_ui_info_int(const char *str, int default_value) |
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
73 { |
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
74 GHashTable *ui_info; |
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
75 |
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
76 ui_info = purple_core_get_ui_info(); |
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
77 if (ui_info != NULL) { |
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
78 gpointer value; |
27429
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27428
diff
changeset
|
79 if (g_hash_table_lookup_extended(ui_info, str, NULL, &value)) |
27428
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
80 return GPOINTER_TO_INT(value); |
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
81 } |
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
82 |
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
83 return default_value; |
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
84 } |
5048054d319a
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <mark@kingant.net>
parents:
27427
diff
changeset
|
85 |
27427
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
86 const char *oscar_get_ui_info_string(const char *str, const char *default_value) |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
87 { |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
88 GHashTable *ui_info; |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
89 const char *value = NULL; |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
90 |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
91 ui_info = purple_core_get_ui_info(); |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
92 if (ui_info != NULL) |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
93 value = g_hash_table_lookup(ui_info, str); |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
94 if (value == NULL) |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
95 value = default_value; |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
96 |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
97 return value; |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
98 } |
4f24d5da4cb3
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <mark@kingant.net>
parents:
25925
diff
changeset
|
99 |
27429
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27428
diff
changeset
|
100 gchar *oscar_get_clientstring(void) |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27428
diff
changeset
|
101 { |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27428
diff
changeset
|
102 const char *name, *version; |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27428
diff
changeset
|
103 |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27428
diff
changeset
|
104 name = oscar_get_ui_info_string("name", "Purple"); |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27428
diff
changeset
|
105 version = oscar_get_ui_info_string("version", VERSION); |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27428
diff
changeset
|
106 |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27428
diff
changeset
|
107 return g_strdup_printf("%s/%s", name, version);; |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27428
diff
changeset
|
108 } |
74e487f82f39
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <mark@kingant.net>
parents:
27428
diff
changeset
|
109 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 * Tokenizing functions. Used to portably replace strtok/sep. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 * -- DMP. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 */ |
18279
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
115 /* TODO: Get rid of this and use glib functions */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 int |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 aimutil_tokslen(char *toSearch, int theindex, char dl) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 int curCount = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 char *next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 char *last; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 int toReturn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 last = toSearch; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 next = strchr(toSearch, dl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 while(curCount < theindex && next != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 curCount++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 last = next + 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 next = strchr(last, dl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 if ((curCount < theindex) || (next == NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 toReturn = strlen(toSearch) - (curCount - 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 toReturn = next - toSearch - (curCount - 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 return toReturn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 int |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 aimutil_itemcnt(char *toSearch, char dl) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 int curCount; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 char *next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 curCount = 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 next = strchr(toSearch, dl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 while(next != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 curCount++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 next = strchr(next + 1, dl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 return curCount; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 char * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 aimutil_itemindex(char *toSearch, int theindex, char dl) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 int curCount; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 char *next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 char *last; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 char *toReturn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 curCount = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 last = toSearch; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 next = strchr(toSearch, dl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 while (curCount < theindex && next != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 curCount++; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 last = next + 1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 next = strchr(last, dl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
177 next = strchr(last, dl); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 if (curCount < theindex) { |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15822
diff
changeset
|
180 toReturn = g_malloc(sizeof(char)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 *toReturn = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
182 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 if (next == NULL) { |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15822
diff
changeset
|
184 toReturn = g_malloc((strlen(last) + 1) * sizeof(char)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
185 strcpy(toReturn, last); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 } else { |
17191
1927f4ead3ca
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15822
diff
changeset
|
187 toReturn = g_malloc((next - last + 1) * sizeof(char)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
188 memcpy(toReturn, last, (next - last)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 toReturn[next - last] = '\0'; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 return toReturn; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
194 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 * Calculate the checksum of a given icon. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 guint16 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 aimutil_iconsum(const guint8 *buf, int buflen) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 guint32 sum; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 for (i=0, sum=0; i+1<buflen; i+=2) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 sum += (buf[i+1] << 8) + buf[i]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 if (i < buflen) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 sum += buf[i]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 sum = ((sum & 0xffff0000) >> 16) + (sum & 0x0000ffff); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 return sum; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 /** |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
214 * Check if the given name is a valid AIM username. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 * Example: BobDole |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 * Example: Henry_Ford@mac.com |
18279
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
217 * Example: 1KrazyKat@example.com |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 * |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
219 * @return TRUE if the name is valid, FALSE if not. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 static gboolean |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
222 oscar_util_valid_name_aim(const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
226 if (purple_email_is_valid(name)) |
18279
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
227 return TRUE; |
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
228 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
229 /* Normal AIM usernames can't start with a number */ |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
230 if (isdigit(name[0])) |
18281
c298830e237f
Make sure we still don't allow screen names of the form "1whatever"
Mark Doliner <mark@kingant.net>
parents:
18279
diff
changeset
|
231 return FALSE; |
c298830e237f
Make sure we still don't allow screen names of the form "1whatever"
Mark Doliner <mark@kingant.net>
parents:
18279
diff
changeset
|
232 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
233 for (i = 0; name[i] != '\0'; i++) { |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
234 if (!isalnum(name[i]) && (name[i] != ' ')) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 /** |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
242 * Check if the given name is a valid ICQ username. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 * Example: 1234567 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 * |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
245 * @return TRUE if the name is valid, FALSE if not. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 */ |
19642
c0f503c18f7e
A little function name shuffling.
Mark Doliner <mark@kingant.net>
parents:
18281
diff
changeset
|
247 gboolean |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
248 oscar_util_valid_name_icq(const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
252 for (i = 0; name[i] != '\0'; i++) { |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
253 if (!isdigit(name[i])) |
18279
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
254 return FALSE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 |
18279
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
257 return TRUE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 /** |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
261 * Check if the given name is a valid SMS username. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 * Example: +19195551234 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 * |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
264 * @return TRUE if the name is valid, FALSE if not. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 */ |
19642
c0f503c18f7e
A little function name shuffling.
Mark Doliner <mark@kingant.net>
parents:
18281
diff
changeset
|
266 gboolean |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
267 oscar_util_valid_name_sms(const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
271 if (name[0] != '+') |
18279
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
272 return FALSE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
274 for (i = 1; name[i] != '\0'; i++) { |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
275 if (!isdigit(name[i])) |
18279
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
276 return FALSE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 |
18279
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
279 return TRUE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 /** |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
283 * Check if the given name is a valid oscar username. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 * |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
285 * @return TRUE if the name is valid, FALSE if not. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 gboolean |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
288 oscar_util_valid_name(const char *name) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 { |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
290 if ((name == NULL) || (*name == '\0')) |
18279
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
291 return FALSE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
293 return oscar_util_valid_name_icq(name) |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
294 || oscar_util_valid_name_sms(name) |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
295 || oscar_util_valid_name_aim(name); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 /** |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
299 * This takes two names and compares them using the rules |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
300 * on usernames for AIM/AOL. Mainly, this means case and space |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 * insensitivity (all case differences and spacing differences are |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
302 * ignored, with the exception that usernames can not start with |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 * a space). |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 * |
18279
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
305 * @return 0 if equal, non-0 if different |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 */ |
18279
48d2c9dbfcc2
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <mark@kingant.net>
parents:
17191
diff
changeset
|
307 /* TODO: Do something different for email addresses. */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 int |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
309 oscar_util_name_compare(const char *name1, const char *name2) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
312 if ((name1 == NULL) || (name2 == NULL)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 return -1; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 do { |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
316 while (*name2 == ' ') |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
317 name2++; |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
318 while (*name1 == ' ') |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
319 name1++; |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
320 if (toupper(*name1) != toupper(*name2)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 return 1; |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
22752
diff
changeset
|
322 } while ((*name1 != '\0') && name1++ && name2++); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 } |
30361
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
326 |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
327 /** |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
328 * Looks for %n, %d, or %t in a string, and replaces them with the |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
329 * specified name, date, and time, respectively. |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
330 * |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
331 * @param str The string that may contain the special variables. |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
332 * @param name The sender name. |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
333 * |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
334 * @return A newly allocated string where the special variables are |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
335 * expanded. This should be g_free'd by the caller. |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
336 */ |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
337 gchar * |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
338 oscar_util_format_string(const char *str, const char *name) |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
339 { |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
340 char *c; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
341 GString *cpy; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
342 time_t t; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
343 struct tm *tme; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
344 |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
345 g_return_val_if_fail(str != NULL, NULL); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
346 g_return_val_if_fail(name != NULL, NULL); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
347 |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
348 /* Create an empty GString that is hopefully big enough for most messages */ |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
349 cpy = g_string_sized_new(1024); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
350 |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
351 t = time(NULL); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
352 tme = localtime(&t); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
353 |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
354 c = (char *)str; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
355 while (*c) { |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
356 switch (*c) { |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
357 case '%': |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
358 if (*(c + 1)) { |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
359 switch (*(c + 1)) { |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
360 case 'n': |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
361 /* append name */ |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
362 g_string_append(cpy, name); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
363 c++; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
364 break; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
365 case 'd': |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
366 /* append date */ |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
367 g_string_append(cpy, purple_date_format_short(tme)); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
368 c++; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
369 break; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
370 case 't': |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
371 /* append time */ |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
372 g_string_append(cpy, purple_time_format(tme)); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
373 c++; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
374 break; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
375 default: |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
376 g_string_append_c(cpy, *c); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
377 } |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
378 } else { |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
379 g_string_append_c(cpy, *c); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
380 } |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
381 break; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
382 default: |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
383 g_string_append_c(cpy, *c); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
384 } |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
385 c++; |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
386 } |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
387 |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
388 return g_string_free(cpy, FALSE); |
9881f18b95b1
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
ivan.komarov@soc.pidgin.im
parents:
29986
diff
changeset
|
389 } |