Tue, 29 Jun 2010 21:17:02 +0000
Added a way to view the Visible/Invisible lists.
The UI is kind of crippled, but that seems to be the best we can do
with the notify API.
|
13235
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
1 | /* |
| 15884 | 2 | * Purple's oscar protocol plugin |
|
13235
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
3 | * This file is the legal property of its developers. |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
4 | * Please see the AUTHORS file distributed alongside this file. |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
5 | * |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
6 | * This library is free software; you can redistribute it and/or |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
7 | * modify it under the terms of the GNU Lesser General Public |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
8 | * License as published by the Free Software Foundation; either |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
9 | * version 2 of the License, or (at your option) any later version. |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
10 | * |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
11 | * This library is distributed in the hope that it will be useful, |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
14 | * Lesser General Public License for more details. |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
15 | * |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
16 | * You should have received a copy of the GNU Lesser General Public |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
17 | * License along with this library; if not, write to the Free Software |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19820
diff
changeset
|
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
13235
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
19 | */ |
|
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
20 | |
| 2086 | 21 | /* |
|
4246
36828a69456f
[gaim-migrate @ 4496]
Mark Doliner <markdoliner@pidgin.im>
parents:
3952
diff
changeset
|
22 | * A little bit of this |
|
36828a69456f
[gaim-migrate @ 4496]
Mark Doliner <markdoliner@pidgin.im>
parents:
3952
diff
changeset
|
23 | * A little bit of that |
|
36828a69456f
[gaim-migrate @ 4496]
Mark Doliner <markdoliner@pidgin.im>
parents:
3952
diff
changeset
|
24 | * It started with a kiss |
|
36828a69456f
[gaim-migrate @ 4496]
Mark Doliner <markdoliner@pidgin.im>
parents:
3952
diff
changeset
|
25 | * Now we're up to bat |
| 2086 | 26 | */ |
| 27 | ||
|
13235
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
28 | #include "oscar.h" |
|
27686
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
29 | |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
30 | #include "core.h" |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
31 | |
| 2086 | 32 | #include <ctype.h> |
| 33 | ||
|
4246
36828a69456f
[gaim-migrate @ 4496]
Mark Doliner <markdoliner@pidgin.im>
parents:
3952
diff
changeset
|
34 | #ifdef _WIN32 |
|
36828a69456f
[gaim-migrate @ 4496]
Mark Doliner <markdoliner@pidgin.im>
parents:
3952
diff
changeset
|
35 | #include "win32dep.h" |
|
36828a69456f
[gaim-migrate @ 4496]
Mark Doliner <markdoliner@pidgin.im>
parents:
3952
diff
changeset
|
36 | #endif |
|
36828a69456f
[gaim-migrate @ 4496]
Mark Doliner <markdoliner@pidgin.im>
parents:
3952
diff
changeset
|
37 | |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
38 | static const char * const msgerrreason[] = { |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
39 | N_("Invalid error"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
40 | N_("Invalid SNAC"), |
|
30641
e21841a64210
Since these messages are shown to the user, they should at least
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30638
diff
changeset
|
41 | N_("Server rate limit exceeded"), |
|
30642
b2af25f17ecd
Fixed a typo. Thanks rlaager!
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30641
diff
changeset
|
42 | N_("Client rate limit exceeded"), |
|
30296
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
43 | N_("Not logged in"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
44 | N_("Service unavailable"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
45 | N_("Service not defined"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
46 | N_("Obsolete SNAC"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
47 | N_("Not supported by host"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
48 | N_("Not supported by client"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
49 | N_("Refused by client"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
50 | N_("Reply too big"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
51 | N_("Responses lost"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
52 | N_("Request denied"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
53 | N_("Busted SNAC payload"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
54 | N_("Insufficient rights"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
55 | N_("In local permit/deny"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
56 | N_("Warning level too high (sender)"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
57 | N_("Warning level too high (receiver)"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
58 | N_("User temporarily unavailable"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
59 | N_("No match"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
60 | N_("List overflow"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
61 | N_("Request ambiguous"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
62 | N_("Queue full"), |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
63 | N_("Not while on AOL") |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
64 | }; |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
65 | static const int msgerrreasonlen = G_N_ELEMENTS(msgerrreason); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
66 | |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
67 | const char *oscar_get_msgerr_reason(size_t reason) |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
68 | { |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
69 | return (reason < msgerrreasonlen) ? _(msgerrreason[reason]) : _("Unknown reason"); |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
70 | } |
|
d97ee3720d8d
Cleanup, basically. Move the icbm snac error handling from oscar.c to
Mark Doliner <markdoliner@pidgin.im>
parents:
27688
diff
changeset
|
71 | |
|
27687
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
72 | int oscar_get_ui_info_int(const char *str, int default_value) |
|
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
73 | { |
|
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
74 | GHashTable *ui_info; |
|
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
75 | |
|
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
76 | ui_info = purple_core_get_ui_info(); |
|
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
77 | if (ui_info != NULL) { |
|
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
78 | gpointer value; |
|
27688
8c89470bfe9d
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27687
diff
changeset
|
79 | if (g_hash_table_lookup_extended(ui_info, str, NULL, &value)) |
|
27687
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
80 | return GPOINTER_TO_INT(value); |
|
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
81 | } |
|
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
82 | |
|
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
83 | return default_value; |
|
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
84 | } |
|
f46b6b5c25e1
Use the ui_info hash table instead of prefs when passing the clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27686
diff
changeset
|
85 | |
|
27686
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
86 | const char *oscar_get_ui_info_string(const char *str, const char *default_value) |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
87 | { |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
88 | GHashTable *ui_info; |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
89 | const char *value = NULL; |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
90 | |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
91 | ui_info = purple_core_get_ui_info(); |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
92 | if (ui_info != NULL) |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
93 | value = g_hash_table_lookup(ui_info, str); |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
94 | if (value == NULL) |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
95 | value = default_value; |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
96 | |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
97 | return value; |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
98 | } |
|
c790e9057b4e
Create a oscar_get_ui_info_string() function that looks up a value in the
Mark Doliner <markdoliner@pidgin.im>
parents:
25889
diff
changeset
|
99 | |
|
27688
8c89470bfe9d
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27687
diff
changeset
|
100 | gchar *oscar_get_clientstring(void) |
|
8c89470bfe9d
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27687
diff
changeset
|
101 | { |
|
8c89470bfe9d
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27687
diff
changeset
|
102 | const char *name, *version; |
|
8c89470bfe9d
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27687
diff
changeset
|
103 | |
|
8c89470bfe9d
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27687
diff
changeset
|
104 | name = oscar_get_ui_info_string("name", "Purple"); |
|
8c89470bfe9d
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27687
diff
changeset
|
105 | version = oscar_get_ui_info_string("version", VERSION); |
|
8c89470bfe9d
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27687
diff
changeset
|
106 | |
|
8c89470bfe9d
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27687
diff
changeset
|
107 | return g_strdup_printf("%s/%s", name, version);; |
|
8c89470bfe9d
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27687
diff
changeset
|
108 | } |
|
8c89470bfe9d
Oh, we don't need a special ui_info field for the AIM clientstring
Mark Doliner <markdoliner@pidgin.im>
parents:
27687
diff
changeset
|
109 | |
| 2086 | 110 | /* |
| 111 | * Tokenizing functions. Used to portably replace strtok/sep. | |
| 112 | * -- DMP. | |
| 113 | * | |
| 114 | */ | |
|
18341
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
115 | /* TODO: Get rid of this and use glib functions */ |
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
116 | int |
|
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
117 | aimutil_tokslen(char *toSearch, int theindex, char dl) |
| 2086 | 118 | { |
|
2246
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
119 | int curCount = 1; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
120 | char *next; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
121 | char *last; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
122 | int toReturn; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
123 | |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
124 | last = toSearch; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
125 | next = strchr(toSearch, dl); |
| 2086 | 126 | |
| 6323 | 127 | while(curCount < theindex && next != NULL) { |
|
2246
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
128 | curCount++; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
129 | last = next + 1; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
130 | next = strchr(last, dl); |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
131 | } |
| 2086 | 132 | |
| 6323 | 133 | if ((curCount < theindex) || (next == NULL)) |
|
2246
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
134 | toReturn = strlen(toSearch) - (curCount - 1); |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
135 | else |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
136 | toReturn = next - toSearch - (curCount - 1); |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
137 | |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
138 | return toReturn; |
| 2086 | 139 | } |
| 140 | ||
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
141 | int |
|
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
142 | aimutil_itemcnt(char *toSearch, char dl) |
| 2086 | 143 | { |
|
2246
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
144 | int curCount; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
145 | char *next; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
146 | |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
147 | curCount = 1; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
148 | |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
149 | next = strchr(toSearch, dl); |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
150 | |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
151 | while(next != NULL) { |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
152 | curCount++; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
153 | next = strchr(next + 1, dl); |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
154 | } |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
155 | |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
156 | return curCount; |
| 2086 | 157 | } |
| 158 | ||
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
159 | char * |
|
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
160 | aimutil_itemindex(char *toSearch, int theindex, char dl) |
| 2086 | 161 | { |
|
2246
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
162 | int curCount; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
163 | char *next; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
164 | char *last; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
165 | char *toReturn; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
166 | |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
167 | curCount = 0; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
168 | |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
169 | last = toSearch; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
170 | next = strchr(toSearch, dl); |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
171 | |
| 6323 | 172 | while (curCount < theindex && next != NULL) { |
|
2246
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
173 | curCount++; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
174 | last = next + 1; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
175 | next = strchr(last, dl); |
| 2086 | 176 | } |
|
2246
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
177 | next = strchr(last, dl); |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
178 | |
| 6323 | 179 | if (curCount < theindex) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
180 | toReturn = g_malloc(sizeof(char)); |
|
2246
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
181 | *toReturn = '\0'; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
182 | } else { |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
183 | if (next == NULL) { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
184 | toReturn = g_malloc((strlen(last) + 1) * sizeof(char)); |
|
2246
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
185 | strcpy(toReturn, last); |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
186 | } else { |
|
17280
7c0472208173
Make all the oscar memory allocations and frees use the glib functions to avoid problems when mixing C runtimes.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
187 | toReturn = g_malloc((next - last + 1) * sizeof(char)); |
|
2246
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
188 | memcpy(toReturn, last, (next - last)); |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
189 | toReturn[next - last] = '\0'; |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
190 | } |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
191 | } |
|
8ade8b7421af
[gaim-migrate @ 2256]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2086
diff
changeset
|
192 | return toReturn; |
| 2086 | 193 | } |
| 194 | ||
|
4617
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
195 | /** |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
196 | * Calculate the checksum of a given icon. |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
197 | */ |
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
198 | guint16 |
|
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
199 | aimutil_iconsum(const guint8 *buf, int buflen) |
|
4617
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
200 | { |
|
13235
72bddc689630
[gaim-migrate @ 15600]
Mark Doliner <markdoliner@pidgin.im>
parents:
13169
diff
changeset
|
201 | guint32 sum; |
|
4617
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
202 | int i; |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
203 | |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
204 | for (i=0, sum=0; i+1<buflen; i+=2) |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
205 | sum += (buf[i+1] << 8) + buf[i]; |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
206 | if (i < buflen) |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
207 | sum += buf[i]; |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
208 | sum = ((sum & 0xffff0000) >> 16) + (sum & 0x0000ffff); |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
209 | |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
210 | return sum; |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
211 | } |
|
35d860860593
[gaim-migrate @ 4908]
Mark Doliner <markdoliner@pidgin.im>
parents:
4246
diff
changeset
|
212 | |
|
8092
ba92ce841814
[gaim-migrate @ 8791]
Mark Doliner <markdoliner@pidgin.im>
parents:
6323
diff
changeset
|
213 | /** |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
214 | * Check if the given name is a valid AIM username. |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
215 | * Example: BobDole |
|
9681
9df6d086ce97
[gaim-migrate @ 10533]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
8982
diff
changeset
|
216 | * Example: Henry_Ford@mac.com |
|
18341
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
217 | * Example: 1KrazyKat@example.com |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
218 | * |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
219 | * @return TRUE if the name is valid, FALSE if not. |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
220 | */ |
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
221 | static gboolean |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
222 | oscar_util_valid_name_aim(const char *name) |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
223 | { |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
224 | int i; |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
225 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
226 | if (purple_email_is_valid(name)) |
|
18341
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
227 | return TRUE; |
|
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
228 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
229 | /* Normal AIM usernames can't start with a number */ |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
230 | if (isdigit(name[0])) |
|
18343
13d96f8a0d7f
Make sure we still don't allow screen names of the form "1whatever"
Mark Doliner <markdoliner@pidgin.im>
parents:
18341
diff
changeset
|
231 | return FALSE; |
|
13d96f8a0d7f
Make sure we still don't allow screen names of the form "1whatever"
Mark Doliner <markdoliner@pidgin.im>
parents:
18341
diff
changeset
|
232 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
233 | for (i = 0; name[i] != '\0'; i++) { |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
234 | if (!isalnum(name[i]) && (name[i] != ' ')) |
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
235 | return FALSE; |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
236 | } |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
237 | |
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
238 | return TRUE; |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
239 | } |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
240 | |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
241 | /** |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
242 | * Check if the given name is a valid ICQ username. |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
243 | * Example: 1234567 |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
244 | * |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
245 | * @return TRUE if the name is valid, FALSE if not. |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
246 | */ |
|
19820
0f82885da3d8
A little function name shuffling.
Mark Doliner <markdoliner@pidgin.im>
parents:
18343
diff
changeset
|
247 | gboolean |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
248 | oscar_util_valid_name_icq(const char *name) |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
249 | { |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
250 | int i; |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
251 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
252 | for (i = 0; name[i] != '\0'; i++) { |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
253 | if (!isdigit(name[i])) |
|
18341
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
254 | return FALSE; |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
255 | } |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
256 | |
|
18341
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
257 | return TRUE; |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
258 | } |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
259 | |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
260 | /** |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
261 | * Check if the given name is a valid SMS username. |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
262 | * Example: +19195551234 |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
263 | * |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
264 | * @return TRUE if the name is valid, FALSE if not. |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
265 | */ |
|
19820
0f82885da3d8
A little function name shuffling.
Mark Doliner <markdoliner@pidgin.im>
parents:
18343
diff
changeset
|
266 | gboolean |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
267 | oscar_util_valid_name_sms(const char *name) |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
268 | { |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
269 | int i; |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
270 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
271 | if (name[0] != '+') |
|
18341
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
272 | return FALSE; |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
273 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
274 | for (i = 1; name[i] != '\0'; i++) { |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
275 | if (!isdigit(name[i])) |
|
18341
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
276 | return FALSE; |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
277 | } |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
278 | |
|
18341
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
279 | return TRUE; |
|
8972
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
280 | } |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
281 | |
|
9fbb6e964df8
[gaim-migrate @ 9746]
Mark Doliner <markdoliner@pidgin.im>
parents:
8885
diff
changeset
|
282 | /** |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
283 | * Check if the given name is a valid oscar username. |
|
8092
ba92ce841814
[gaim-migrate @ 8791]
Mark Doliner <markdoliner@pidgin.im>
parents:
6323
diff
changeset
|
284 | * |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
285 | * @return TRUE if the name is valid, FALSE if not. |
|
8092
ba92ce841814
[gaim-migrate @ 8791]
Mark Doliner <markdoliner@pidgin.im>
parents:
6323
diff
changeset
|
286 | */ |
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
287 | gboolean |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
288 | oscar_util_valid_name(const char *name) |
|
8092
ba92ce841814
[gaim-migrate @ 8791]
Mark Doliner <markdoliner@pidgin.im>
parents:
6323
diff
changeset
|
289 | { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
290 | if ((name == NULL) || (*name == '\0')) |
|
18341
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
291 | return FALSE; |
|
8092
ba92ce841814
[gaim-migrate @ 8791]
Mark Doliner <markdoliner@pidgin.im>
parents:
6323
diff
changeset
|
292 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
293 | return oscar_util_valid_name_icq(name) |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
294 | || oscar_util_valid_name_sms(name) |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
295 | || oscar_util_valid_name_aim(name); |
|
8092
ba92ce841814
[gaim-migrate @ 8791]
Mark Doliner <markdoliner@pidgin.im>
parents:
6323
diff
changeset
|
296 | } |
|
ba92ce841814
[gaim-migrate @ 8791]
Mark Doliner <markdoliner@pidgin.im>
parents:
6323
diff
changeset
|
297 | |
|
9975
ea6d503b89cb
[gaim-migrate @ 10886]
Mark Doliner <markdoliner@pidgin.im>
parents:
9681
diff
changeset
|
298 | /** |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
299 | * This takes two names and compares them using the rules |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
300 | * on usernames for AIM/AOL. Mainly, this means case and space |
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
301 | * insensitivity (all case differences and spacing differences are |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
302 | * ignored, with the exception that usernames can not start with |
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
303 | * a space). |
|
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
304 | * |
|
18341
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
305 | * @return 0 if equal, non-0 if different |
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
306 | */ |
|
18341
8990ff4ec97c
Allow AIM screen names of the form "1abc@example.com" In most places
Mark Doliner <markdoliner@pidgin.im>
parents:
17280
diff
changeset
|
307 | /* TODO: Do something different for email addresses. */ |
|
13607
3f75dc90654e
[gaim-migrate @ 15992]
Mark Doliner <markdoliner@pidgin.im>
parents:
13593
diff
changeset
|
308 | int |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
309 | oscar_util_name_compare(const char *name1, const char *name2) |
| 2086 | 310 | { |
| 311 | ||
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
312 | if ((name1 == NULL) || (name2 == NULL)) |
|
10116
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9975
diff
changeset
|
313 | return -1; |
|
054b064145a1
[gaim-migrate @ 11153]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9975
diff
changeset
|
314 | |
|
5928
9d5ace6e5354
[gaim-migrate @ 6368]
Mark Doliner <markdoliner@pidgin.im>
parents:
5927
diff
changeset
|
315 | do { |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
316 | while (*name2 == ' ') |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
317 | name2++; |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
318 | while (*name1 == ' ') |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
319 | name1++; |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
320 | if (toupper(*name1) != toupper(*name2)) |
|
5928
9d5ace6e5354
[gaim-migrate @ 6368]
Mark Doliner <markdoliner@pidgin.im>
parents:
5927
diff
changeset
|
321 | return 1; |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
22900
diff
changeset
|
322 | } while ((*name1 != '\0') && name1++ && name2++); |
| 2086 | 323 | |
|
5928
9d5ace6e5354
[gaim-migrate @ 6368]
Mark Doliner <markdoliner@pidgin.im>
parents:
5927
diff
changeset
|
324 | return 0; |
| 2086 | 325 | } |
|
30638
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
326 | |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
327 | /** |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
328 | * Looks for %n, %d, or %t in a string, and replaces them with the |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
329 | * specified name, date, and time, respectively. |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
330 | * |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
331 | * @param str The string that may contain the special variables. |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
332 | * @param name The sender name. |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
333 | * |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
334 | * @return A newly allocated string where the special variables are |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
335 | * expanded. This should be g_free'd by the caller. |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
336 | */ |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
337 | gchar * |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
338 | oscar_util_format_string(const char *str, const char *name) |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
339 | { |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
340 | char *c; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
341 | GString *cpy; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
342 | time_t t; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
343 | struct tm *tme; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
344 | |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
345 | g_return_val_if_fail(str != NULL, NULL); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
346 | g_return_val_if_fail(name != NULL, NULL); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
347 | |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
348 | /* Create an empty GString that is hopefully big enough for most messages */ |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
349 | cpy = g_string_sized_new(1024); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
350 | |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
351 | t = time(NULL); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
352 | tme = localtime(&t); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
353 | |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
354 | c = (char *)str; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
355 | while (*c) { |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
356 | switch (*c) { |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
357 | case '%': |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
358 | if (*(c + 1)) { |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
359 | switch (*(c + 1)) { |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
360 | case 'n': |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
361 | /* append name */ |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
362 | g_string_append(cpy, name); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
363 | c++; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
364 | break; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
365 | case 'd': |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
366 | /* append date */ |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
367 | g_string_append(cpy, purple_date_format_short(tme)); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
368 | c++; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
369 | break; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
370 | case 't': |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
371 | /* append time */ |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
372 | g_string_append(cpy, purple_time_format(tme)); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
373 | c++; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
374 | break; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
375 | default: |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
376 | g_string_append_c(cpy, *c); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
377 | } |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
378 | } else { |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
379 | g_string_append_c(cpy, *c); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
380 | } |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
381 | break; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
382 | default: |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
383 | g_string_append_c(cpy, *c); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
384 | } |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
385 | c++; |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
386 | } |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
387 | |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
388 | return g_string_free(cpy, FALSE); |
|
2f1952f26351
Got rid of family_icq.c -> oscar.c callbacks. Now it will be possible
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30296
diff
changeset
|
389 | } |
|
30650
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
390 | |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
391 | gchar * |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
392 | oscar_format_buddies(GSList *buddies, const gchar *no_buddies_message) |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
393 | { |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
394 | GSList *cur; |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
395 | gchar *result, *tmp; |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
396 | if (!buddies) { |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
397 | return g_strdup_printf("<i>%s</i>", no_buddies_message); |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
398 | } |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
399 | result = g_strdup(""); |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
400 | for (cur = buddies; cur != NULL; cur = cur->next) { |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
401 | PurpleBuddy *buddy = cur->data; |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
402 | const gchar *bname = purple_buddy_get_name(buddy); |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
403 | const gchar *alias = purple_buddy_get_alias_only(buddy); |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
404 | if (alias) { |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
405 | tmp = g_strdup_printf("%s%s (%s)<br>", result, bname, alias); |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
406 | } else { |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
407 | tmp = g_strdup_printf("%s%s<br>", result, bname); |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
408 | } |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
409 | g_free(result); |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
410 | result = tmp; |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
411 | } |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
412 | return result; |
|
1e60e49674dd
Added a way to view the Visible/Invisible lists.
Ivan Komarov <ivan.komarov@pidgin.im>
parents:
30642
diff
changeset
|
413 | } |