Mercurial > pidgin
annotate libpurple/protocols/msn/msnutils.c @ 31782:727edf2625f5
Patch up merge
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Thu, 11 Aug 2011 14:45:26 +0000 |
parents | 5981b4116b52 |
children | 0ab12023a1bc |
rev | line source |
---|---|
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
1 /** |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
2 * @file msnutils.c Utility functions |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
3 * |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
4 * purple |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
5 * |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
6 * Purple is the legal property of its developers, whose names are too numerous |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
8 * source distribution. |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
9 * |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
14 * |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
19 * |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
20514
723b5a2f91ce
explicit merge of 'd565bd9a8e62d3302ac14bb7c3a68a52c0c6a65e'
Richard Laager <rlaager@wiktel.com>
parents:
20471
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
23 */ |
30758
230caecf5435
Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents:
30745
diff
changeset
|
24 |
230caecf5435
Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents:
30745
diff
changeset
|
25 #include "internal.h" |
230caecf5435
Include internal.h on each c file to avoid windows breakage as recommended by Daniel.
masca@cpw.pidgin.im
parents:
30745
diff
changeset
|
26 |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
27 #include "msn.h" |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
28 #include "msnutils.h" |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
29 |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
30 #include "cipher.h" |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
31 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
32 /************************************************************************** |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
33 * Util |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
34 **************************************************************************/ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
35 char * |
30724
5a70b5364229
Remove an unnecessary forward declaration
Mark Doliner <mark@kingant.net>
parents:
27481
diff
changeset
|
36 rand_guid(void) |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
37 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
38 return g_strdup_printf("%4X%4X-%4X-%4X-%4X-%4X%4X%4X", |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
39 rand() % 0xAAFF + 0x1111, |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
40 rand() % 0xAAFF + 0x1111, |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
41 rand() % 0xAAFF + 0x1111, |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
42 rand() % 0xAAFF + 0x1111, |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
43 rand() % 0xAAFF + 0x1111, |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
44 rand() % 0xAAFF + 0x1111, |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
45 rand() % 0xAAFF + 0x1111, |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
46 rand() % 0xAAFF + 0x1111); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
47 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
48 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
49 void |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
50 msn_parse_format(const char *mime, char **pre_ret, char **post_ret) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
51 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
52 char *cur; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
53 GString *pre = g_string_new(NULL); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
54 GString *post = g_string_new(NULL); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
55 unsigned int colors[3]; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
56 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
57 if (pre_ret != NULL) *pre_ret = NULL; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
58 if (post_ret != NULL) *post_ret = NULL; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
59 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
60 cur = strstr(mime, "FN="); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
61 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
62 if (cur && (*(cur = cur + 3) != ';')) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
63 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
64 pre = g_string_append(pre, "<FONT FACE=\""); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
65 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
66 while (*cur && *cur != ';') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
67 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
68 pre = g_string_append_c(pre, *cur); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
69 cur++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
70 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
71 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
72 pre = g_string_append(pre, "\">"); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
73 post = g_string_prepend(post, "</FONT>"); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
74 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
75 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
76 cur = strstr(mime, "EF="); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
77 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
78 if (cur && (*(cur = cur + 3) != ';')) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
79 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
80 while (*cur && *cur != ';') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
81 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
82 pre = g_string_append_c(pre, '<'); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
83 pre = g_string_append_c(pre, *cur); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
84 pre = g_string_append_c(pre, '>'); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
85 post = g_string_prepend_c(post, '>'); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
86 post = g_string_prepend_c(post, *cur); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
87 post = g_string_prepend_c(post, '/'); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
88 post = g_string_prepend_c(post, '<'); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
89 cur++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
90 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
91 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
92 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
93 cur = strstr(mime, "CO="); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
94 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
95 if (cur && (*(cur = cur + 3) != ';')) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
96 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
97 int i; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
98 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
99 i = sscanf(cur, "%02x%02x%02x;", &colors[0], &colors[1], &colors[2]); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
100 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
101 if (i > 0) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
102 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
103 char tag[64]; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
104 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
105 if (i == 1) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
106 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
107 colors[1] = 0; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
108 colors[2] = 0; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
109 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
110 else if (i == 2) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
111 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
112 unsigned int temp = colors[0]; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
113 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
114 colors[0] = colors[1]; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
115 colors[1] = temp; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
116 colors[2] = 0; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
117 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
118 else if (i == 3) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
119 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
120 unsigned int temp = colors[2]; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
121 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
122 colors[2] = colors[0]; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
123 colors[0] = temp; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
124 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
125 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
126 g_snprintf(tag, sizeof(tag), |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
127 "<FONT COLOR=\"#%02hhx%02hhx%02hhx\">", |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
128 colors[0], colors[1], colors[2]); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
129 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
130 pre = g_string_append(pre, tag); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
131 post = g_string_prepend(post, "</FONT>"); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
132 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
133 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
134 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
135 cur = strstr(mime, "RL="); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
136 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
137 if (cur && (*(cur = cur + 3) != ';')) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
138 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
139 if (*cur == '1') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
140 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
141 /* RTL text was received */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
142 pre = g_string_append(pre, "<SPAN style=\"direction:rtl;text-align:right;\">"); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
143 post = g_string_prepend(post, "</SPAN>"); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
144 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
145 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
146 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
147 cur = g_strdup(purple_url_decode(pre->str)); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
148 g_string_free(pre, TRUE); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
149 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
150 if (pre_ret != NULL) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
151 *pre_ret = cur; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
152 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
153 g_free(cur); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
154 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
155 cur = g_strdup(purple_url_decode(post->str)); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
156 g_string_free(post, TRUE); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
157 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
158 if (post_ret != NULL) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
159 *post_ret = cur; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
160 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
161 g_free(cur); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
162 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
163 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
164 /*encode the str to RFC2047 style |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
165 * Currently only support the UTF-8 and base64 encode |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
166 */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
167 char * |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
168 msn_encode_mime(const char *str) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
169 { |
20990 | 170 gchar *base64, *retval; |
171 | |
172 g_return_val_if_fail(str != NULL, NULL); | |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22383
diff
changeset
|
173 |
20403
599b5a4aebab
The last of the merge fix-ups.
Richard Laager <rlaager@wiktel.com>
parents:
20400
diff
changeset
|
174 base64 = purple_base64_encode((guchar *)str, strlen(str)); |
20990 | 175 retval = g_strdup_printf("=?utf-8?B?%s?=", base64); |
176 g_free(base64); | |
177 | |
178 return retval; | |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
179 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
180 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
181 /* |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
182 * We need this because we're only supposed to encode spaces in the font |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
183 * names. purple_url_encode() isn't acceptable. |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
184 */ |
30993
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
185 gboolean |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
186 msn_encode_spaces(const char *str, char *buf, size_t len) |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
187 { |
30993
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
188 char *nonspace = buf; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
189 |
30993
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
190 while (isspace(*str)) |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
191 str++; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
192 |
30993
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
193 for (; *str && len > 1; str++) { |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
194 if (*str == '%') { |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
195 if (len < 4) |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
196 break; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
197 *buf++ = '%'; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
198 *buf++ = '2'; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
199 *buf++ = '5'; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
200 len -= 3; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
201 nonspace = buf; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
202 } else if (*str == ' ') { |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
203 if (len < 4) |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
204 break; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
205 *buf++ = '%'; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
206 *buf++ = '2'; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
207 *buf++ = '0'; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
208 len -= 3; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
209 } else { |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
210 *buf++ = *str; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
211 len--; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
212 nonspace = buf; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
213 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
214 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
215 |
30993
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
216 *nonspace = '\0'; |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
217 |
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
218 return (*str == '\0'); |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
219 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
220 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
221 /* |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
222 * Taken from the zephyr plugin. |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
223 * This parses HTML formatting (put out by one of the gtkimhtml widgets |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
224 * and converts it to msn formatting. It doesn't deal with the tag closing, |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
225 * but gtkimhtml widgets give valid html. |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
226 * It currently deals properly with <b>, <u>, <i>, <font face=...>, |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
227 * <font color=...>, <span dir=...>, <span style="direction: ...">. |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
228 * It ignores <font back=...> and <font size=...> |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
229 */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
230 void |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
231 msn_import_html(const char *html, char **attributes, char **message) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
232 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
233 int len, retcount = 0; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
234 const char *c; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
235 char *msg; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
236 char *fontface = NULL; |
30993
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
237 char fontface_encoded[BUF_LEN]; |
27481
444542a43790
Bold + Underline + Italic + Strikethrough + NUL character equals 5 bytes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25459
diff
changeset
|
238 char fonteffect[5]; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
239 char fontcolor[7]; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
240 char direction = '0'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
241 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
242 gboolean has_bold = FALSE; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
243 gboolean has_italic = FALSE; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
244 gboolean has_underline = FALSE; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
245 gboolean has_strikethrough = FALSE; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
246 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
247 g_return_if_fail(html != NULL); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
248 g_return_if_fail(attributes != NULL); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
249 g_return_if_fail(message != NULL); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
250 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
251 len = strlen(html); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
252 msg = g_malloc0(len + 1); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
253 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
254 memset(fontcolor, 0, sizeof(fontcolor)); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
255 strcat(fontcolor, "0"); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
256 memset(fonteffect, 0, sizeof(fonteffect)); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
257 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
258 for (c = html; *c != '\0';) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
259 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
260 if (*c == '<') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
261 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
262 if (!g_ascii_strncasecmp(c + 1, "br>", 3)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
263 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
264 msg[retcount++] = '\r'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
265 msg[retcount++] = '\n'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
266 c += 4; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
267 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
268 else if (!g_ascii_strncasecmp(c + 1, "i>", 2)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
269 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
270 if (!has_italic) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
271 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
272 strcat(fonteffect, "I"); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
273 has_italic = TRUE; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
274 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
275 c += 3; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
276 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
277 else if (!g_ascii_strncasecmp(c + 1, "b>", 2)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
278 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
279 if (!has_bold) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
280 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
281 strcat(fonteffect, "B"); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
282 has_bold = TRUE; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
283 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
284 c += 3; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
285 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
286 else if (!g_ascii_strncasecmp(c + 1, "u>", 2)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
287 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
288 if (!has_underline) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
289 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
290 strcat(fonteffect, "U"); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
291 has_underline = TRUE; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
292 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
293 c += 3; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
294 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
295 else if (!g_ascii_strncasecmp(c + 1, "s>", 2)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
296 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
297 if (!has_strikethrough) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
298 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
299 strcat(fonteffect, "S"); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
300 has_strikethrough = TRUE; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
301 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
302 c += 3; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
303 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
304 else if (!g_ascii_strncasecmp(c + 1, "a href=\"", 8)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
305 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
306 c += 9; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
307 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
308 if (!g_ascii_strncasecmp(c, "mailto:", 7)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
309 c += 7; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
310 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
311 while ((*c != '\0') && g_ascii_strncasecmp(c, "\">", 2)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
312 msg[retcount++] = *c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
313 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
314 if (*c != '\0') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
315 c += 2; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
316 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
317 /* ignore descriptive string */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
318 while ((*c != '\0') && g_ascii_strncasecmp(c, "</a>", 4)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
319 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
320 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
321 if (*c != '\0') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
322 c += 4; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
323 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
324 else if (!g_ascii_strncasecmp(c + 1, "span", 4)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
325 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
326 /* Bi-directional text support using CSS properties in span tags */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
327 c += 5; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
328 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
329 while (*c != '\0' && *c != '>') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
330 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
331 while (*c == ' ') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
332 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
333 if (!g_ascii_strncasecmp(c, "dir=\"rtl\"", 9)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
334 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
335 c += 9; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
336 direction = '1'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
337 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
338 else if (!g_ascii_strncasecmp(c, "style=\"", 7)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
339 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
340 /* Parse inline CSS attributes */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
341 char *attributes; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
342 int attr_len = 0; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
343 c += 7; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
344 while (*(c + attr_len) != '\0' && *(c + attr_len) != '"') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
345 attr_len++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
346 if (*(c + attr_len) == '"') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
347 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
348 char *attr_dir; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
349 attributes = g_strndup(c, attr_len); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
350 attr_dir = purple_markup_get_css_property(attributes, "direction"); |
20461
25542d5c94ed
propagate from branch 'im.pidgin.pidgin' (head 007693114b23cd2711c1cb9030a148e2f63de8c8)
Ka-Hing Cheung <khc@hxbc.us>
parents:
20424
diff
changeset
|
351 if (attr_dir && (!g_ascii_strncasecmp(attr_dir, "RTL", 3))) |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
352 direction = '1'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
353 g_free(attr_dir); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
354 g_free(attributes); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
355 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
356 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
357 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
358 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
359 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
360 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
361 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
362 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
363 if (*c == '>') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
364 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
365 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
366 else if (!g_ascii_strncasecmp(c + 1, "font", 4)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
367 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
368 c += 5; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
369 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
370 while ((*c != '\0') && !g_ascii_strncasecmp(c, " ", 1)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
371 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
372 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
373 if (!g_ascii_strncasecmp(c, "color=\"#", 7)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
374 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
375 c += 8; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
376 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
377 fontcolor[0] = *(c + 4); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
378 fontcolor[1] = *(c + 5); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
379 fontcolor[2] = *(c + 2); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
380 fontcolor[3] = *(c + 3); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
381 fontcolor[4] = *c; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
382 fontcolor[5] = *(c + 1); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
383 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
384 c += 8; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
385 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
386 else if (!g_ascii_strncasecmp(c, "face=\"", 6)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
387 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
388 const char *end = NULL; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
389 const char *comma = NULL; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
390 unsigned int namelen = 0; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
391 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
392 c += 6; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
393 end = strchr(c, '\"'); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
394 comma = strchr(c, ','); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
395 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
396 if (comma == NULL || comma > end) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
397 namelen = (unsigned int)(end - c); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
398 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
399 namelen = (unsigned int)(comma - c); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
400 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
401 fontface = g_strndup(c, namelen); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
402 c = end + 2; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
403 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
404 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
405 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
406 /* Drop all unrecognized/misparsed font tags */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
407 while ((*c != '\0') && g_ascii_strncasecmp(c, "\">", 2)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
408 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
409 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
410 if (*c != '\0') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
411 c += 2; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
412 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
413 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
414 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
415 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
416 while ((*c != '\0') && (*c != '>')) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
417 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
418 if (*c != '\0') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
419 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
420 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
421 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
422 else if (*c == '&') |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
423 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
424 if (!g_ascii_strncasecmp(c, "<", 4)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
425 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
426 msg[retcount++] = '<'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
427 c += 4; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
428 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
429 else if (!g_ascii_strncasecmp(c, ">", 4)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
430 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
431 msg[retcount++] = '>'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
432 c += 4; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
433 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
434 else if (!g_ascii_strncasecmp(c, " ", 6)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
435 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
436 msg[retcount++] = ' '; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
437 c += 6; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
438 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
439 else if (!g_ascii_strncasecmp(c, """, 6)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
440 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
441 msg[retcount++] = '"'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
442 c += 6; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
443 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
444 else if (!g_ascii_strncasecmp(c, "&", 5)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
445 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
446 msg[retcount++] = '&'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
447 c += 5; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
448 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
449 else if (!g_ascii_strncasecmp(c, "'", 6)) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
450 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
451 msg[retcount++] = '\''; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
452 c += 6; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
453 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
454 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
455 msg[retcount++] = *c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
456 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
457 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
458 msg[retcount++] = *c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
459 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
460 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
461 if (fontface == NULL) |
25459
9487c9b7a01f
Send "Segoe UI" if no font is determined from the UI's HTML.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23521
diff
changeset
|
462 fontface = g_strdup("Segoe UI"); |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
463 |
30993
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
464 msn_encode_spaces(fontface, fontface_encoded, BUF_LEN); |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
465 *attributes = g_strdup_printf("FN=%s; EF=%s; CO=%s; PF=0; RL=%c", |
30993
dc996aa83f49
Combine the encode_spaces function and the stuff for the display name
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30877
diff
changeset
|
466 fontface_encoded, |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
467 fonteffect, fontcolor, direction); |
20983
64644b98c20c
Avoid unnecessary alloc/free.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20514
diff
changeset
|
468 *message = msg; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
469 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
470 g_free(fontface); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
471 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
472 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
473 void |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
474 msn_parse_socket(const char *str, char **ret_host, int *ret_port) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
475 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
476 char *host; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
477 char *c; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
478 int port; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
479 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
480 host = g_strdup(str); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
481 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
482 if ((c = strchr(host, ':')) != NULL) { |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
483 *c = '\0'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
484 port = atoi(c + 1); |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
485 } else { |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
486 port = 1863; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
487 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
488 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
489 *ret_host = host; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
490 *ret_port = port; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
491 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
492 |
30745
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
493 gboolean |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
494 msn_email_is_valid(const char *passport) |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
495 { |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
496 if (purple_email_is_valid(passport)) { |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
497 /* Special characters aren't allowed in domains, so only go to '@' */ |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
498 while (*passport != '@') { |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
499 if (*passport == '/') |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
500 return FALSE; |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
501 else if (*passport == '?') |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
502 return FALSE; |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
503 else if (*passport == '=') |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
504 return FALSE; |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
505 /* MSN also doesn't like colons, but that's checked already */ |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
506 |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
507 passport++; |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
508 } |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
509 |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
510 return TRUE; |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
511 } |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
512 |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
513 return FALSE; |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
514 } |
0201164946a3
msn_email_is_valid looks a lot like a util function, move it there.
masca@cpw.pidgin.im
parents:
30724
diff
changeset
|
515 |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
516 /*************************************************************************** |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
517 * MSN Challenge Computing Function |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
518 ***************************************************************************/ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
519 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
520 /* |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
521 * Handle MSN Challenge computation |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
522 * This algorithm references |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
523 * http://imfreedom.org/wiki/index.php/MSN:NS/Challenges |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
524 */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
525 #define BUFSIZE 256 |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22383
diff
changeset
|
526 void |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
527 msn_handle_chl(char *input, char *output) |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
528 { |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
529 PurpleCipher *cipher; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
530 PurpleCipherContext *context; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
531 const guchar productKey[] = MSNP15_WLM_PRODUCT_KEY; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
532 const guchar productID[] = MSNP15_WLM_PRODUCT_ID; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
533 const char hexChars[] = "0123456789abcdef"; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
534 char buf[BUFSIZE]; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
535 unsigned char md5Hash[16]; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
536 unsigned char *newHash; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
537 unsigned int *md5Parts; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
538 unsigned int *chlStringParts; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
539 unsigned int newHashParts[5]; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
540 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
541 long long nHigh = 0, nLow = 0; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
542 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
543 int len; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
544 int i; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
545 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
546 /* Create the MD5 hash by using Purple MD5 algorithm */ |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
547 cipher = purple_ciphers_find_cipher("md5"); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
548 context = purple_cipher_context_new(cipher, NULL); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
549 |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
550 purple_cipher_context_append(context, (guchar *)input, strlen(input)); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
551 purple_cipher_context_append(context, productKey, sizeof(productKey) - 1); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
552 purple_cipher_context_digest(context, sizeof(md5Hash), md5Hash, NULL); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
553 purple_cipher_context_destroy(context); |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
554 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
555 /* Split it into four integers */ |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
556 md5Parts = (unsigned int *)md5Hash; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
557 for (i = 0; i < 4; i++) { |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
558 /* adjust endianess */ |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
559 md5Parts[i] = GUINT_TO_LE(md5Parts[i]); |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
560 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
561 /* & each integer with 0x7FFFFFFF */ |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
562 /* and save one unmodified array for later */ |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
563 newHashParts[i] = md5Parts[i]; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
564 md5Parts[i] &= 0x7FFFFFFF; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
565 } |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
566 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
567 /* make a new string and pad with '0' to length that's a multiple of 8 */ |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
568 snprintf(buf, BUFSIZE - 5, "%s%s", input, productID); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
569 len = strlen(buf); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
570 if ((len % 8) != 0) { |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
571 int fix = 8 - (len % 8); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
572 memset(&buf[len], '0', fix); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
573 buf[len + fix] = '\0'; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
574 len += fix; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
575 } |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
576 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
577 /* split into integers */ |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
578 chlStringParts = (unsigned int *)buf; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
579 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
580 /* this is magic */ |
30427
8490c8eb4aa8
We already have the length of the string. Don't need to call strlen.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27481
diff
changeset
|
581 for (i = 0; i < (len / 4); i += 2) { |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
582 long long temp; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
583 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
584 chlStringParts[i] = GUINT_TO_LE(chlStringParts[i]); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
585 chlStringParts[i + 1] = GUINT_TO_LE(chlStringParts[i + 1]); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
586 |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
587 temp = (0x0E79A9C1 * (long long)chlStringParts[i]) % 0x7FFFFFFF; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
588 temp = (md5Parts[0] * (temp + nLow) + md5Parts[1]) % 0x7FFFFFFF; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
589 nHigh += temp; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
590 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
591 temp = ((long long)chlStringParts[i + 1] + temp) % 0x7FFFFFFF; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
592 nLow = (md5Parts[2] * temp + md5Parts[3]) % 0x7FFFFFFF; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
593 nHigh += nLow; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
594 } |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
595 nLow = (nLow + md5Parts[1]) % 0x7FFFFFFF; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
596 nHigh = (nHigh + md5Parts[3]) % 0x7FFFFFFF; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
597 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
598 newHashParts[0] ^= nLow; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
599 newHashParts[1] ^= nHigh; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
600 newHashParts[2] ^= nLow; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
601 newHashParts[3] ^= nHigh; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
602 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
603 /* adjust endianness */ |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
604 for(i = 0; i < 4; i++) |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
605 newHashParts[i] = GUINT_TO_LE(newHashParts[i]); |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
606 |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
607 /* make a string of the parts */ |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
608 newHash = (unsigned char *)newHashParts; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
609 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
610 /* convert to hexadecimal */ |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
611 for (i = 0; i < 16; i++) |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
612 { |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
613 output[i * 2] = hexChars[(newHash[i] >> 4) & 0xF]; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
614 output[(i * 2) + 1] = hexChars[newHash[i] & 0xF]; |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
615 } |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
616 |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
617 output[32] = '\0'; |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
618 } |
23496
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
619 |
31043
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
620 guint8 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
621 msn_read8(const char *buf) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
622 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
623 return (guint8)buf[0]; |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
624 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
625 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
626 guint16 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
627 msn_read16le(const char *buf) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
628 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
629 return GUINT16_FROM_LE(*(guint16 *)buf); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
630 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
631 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
632 guint16 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
633 msn_read16be(const char *buf) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
634 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
635 return GUINT16_FROM_BE(*(guint16 *)buf); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
636 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
637 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
638 guint32 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
639 msn_read32le(const char *buf) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
640 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
641 return GUINT32_FROM_LE(*(guint32 *)buf); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
642 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
643 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
644 guint32 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
645 msn_read32be(const char *buf) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
646 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
647 return GUINT32_FROM_BE(*(guint32 *)buf); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
648 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
649 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
650 guint64 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
651 msn_read64le(const char *buf) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
652 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
653 return GUINT64_FROM_LE(*(guint64 *)buf); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
654 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
655 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
656 guint64 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
657 msn_read64be(const char *buf) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
658 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
659 return GUINT64_FROM_BE(*(guint64 *)buf); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
660 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
661 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
662 void |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
663 msn_write8(char *buf, guint8 data) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
664 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
665 *(guint8 *)buf = data; |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
666 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
667 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
668 void |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
669 msn_write16le(char *buf, guint16 data) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
670 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
671 *(guint16 *)buf = GUINT16_TO_LE(data); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
672 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
673 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
674 void |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
675 msn_write16be(char *buf, guint16 data) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
676 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
677 *(guint16 *)buf = GUINT16_TO_BE(data); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
678 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
679 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
680 void |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
681 msn_write32le(char *buf, guint32 data) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
682 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
683 *(guint32 *)buf = GUINT32_TO_LE(data); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
684 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
685 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
686 void |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
687 msn_write32be(char *buf, guint32 data) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
688 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
689 *(guint32 *)buf = GUINT32_TO_BE(data); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
690 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
691 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
692 void |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
693 msn_write64le(char *buf, guint64 data) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
694 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
695 *(guint64 *)buf = GUINT64_TO_LE(data); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
696 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
697 |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
698 void |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
699 msn_write64be(char *buf, guint64 data) |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
700 { |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
701 *(guint64 *)buf = GUINT64_TO_BE(data); |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
702 } |
5981b4116b52
Add some buffer reading/writing functions. I don't know if these are
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30993
diff
changeset
|
703 |