Mercurial > pidgin
annotate libpurple/protocols/msn/msnutils.c @ 28984:7f97370e674b
Use our MsnListOp enum in more places instead of int. I'm assuming
the reason this wasn't done before is because of the circular header
file dependencies. But that should be fine now that enums are
declared before #includes
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 05 Feb 2010 22:54:00 +0000 |
parents | 444542a43790 |
children | 8490c8eb4aa8 5a70b5364229 |
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 */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
24 #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
|
25 #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
|
26 |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
27 #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
|
28 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
29 char *rand_guid(void); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
30 |
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 * Util |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
33 **************************************************************************/ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
34 char * |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
35 rand_guid() |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
36 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
37 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
|
38 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
|
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 } |
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 void |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
49 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
|
50 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
51 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
|
52 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
|
53 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
|
54 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
|
55 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
56 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
|
57 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
|
58 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
59 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
|
60 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
61 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
|
62 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
63 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
|
64 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
65 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
|
66 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
67 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
|
68 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 } |
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 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
|
72 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
|
73 } |
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 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
|
76 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
77 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
|
78 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
79 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
|
80 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
81 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
|
82 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
|
83 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
|
84 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
|
85 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
|
86 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
|
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 cur++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
89 } |
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 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
|
93 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
94 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
|
95 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
96 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
|
97 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
98 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
|
99 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
100 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
|
101 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
102 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
|
103 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
104 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
|
105 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
106 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
|
107 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
|
108 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
109 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
|
110 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
111 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
|
112 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
113 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
|
114 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
|
115 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
|
116 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
117 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
|
118 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
119 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
|
120 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
121 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
|
122 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
|
123 } |
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 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
|
126 "<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
|
127 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
|
128 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
129 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
|
130 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
|
131 } |
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 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
|
135 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
136 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
|
137 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
138 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
|
139 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
140 /* 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
|
141 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
|
142 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
|
143 } |
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 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
|
147 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
|
148 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
149 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
|
150 *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
|
151 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
152 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
|
153 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
154 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
|
155 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
|
156 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
157 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
|
158 *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
|
159 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
160 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
|
161 } |
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 /*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
|
164 * 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
|
165 */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
166 char * |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
167 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
|
168 { |
20990 | 169 gchar *base64, *retval; |
170 | |
171 g_return_val_if_fail(str != NULL, NULL); | |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22383
diff
changeset
|
172 |
20403
599b5a4aebab
The last of the merge fix-ups.
Richard Laager <rlaager@wiktel.com>
parents:
20400
diff
changeset
|
173 base64 = purple_base64_encode((guchar *)str, strlen(str)); |
20990 | 174 retval = g_strdup_printf("=?utf-8?B?%s?=", base64); |
175 g_free(base64); | |
176 | |
177 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
|
178 } |
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 * 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
|
182 * 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
|
183 */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
184 static const char * |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
185 encode_spaces(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
|
186 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
187 static char buf[BUF_LEN]; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
188 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
|
189 char *d; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
190 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
191 g_return_val_if_fail(str != NULL, NULL); |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
192 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
193 for (c = str, d = buf; *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
|
194 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
195 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
|
196 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
197 *d++ = '%'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
198 *d++ = '2'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
199 *d++ = '0'; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
200 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
201 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
202 *d++ = *c; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
203 } |
22383
50e5ac417035
Patch from Qulogic that fixes #4951 by making sure that the buffer is NUL-
Ka-Hing Cheung <khc@hxbc.us>
parents:
20990
diff
changeset
|
204 *d = '\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
|
205 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
206 return buf; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
207 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
208 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
209 /* |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
210 * 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
|
211 * 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
|
212 * 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
|
213 * 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
|
214 * 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
|
215 * <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
|
216 * 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
|
217 */ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
218 void |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
219 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
|
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 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
|
222 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
|
223 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
|
224 char *fontface = NULL; |
27481
444542a43790
Bold + Underline + Italic + Strikethrough + NUL character equals 5 bytes,
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25459
diff
changeset
|
225 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
|
226 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
|
227 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
|
228 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
229 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
|
230 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
|
231 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
|
232 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
|
233 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
234 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
|
235 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
|
236 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
|
237 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
238 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
|
239 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
|
240 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
241 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
|
242 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
|
243 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
|
244 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
245 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
|
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 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
|
248 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
249 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
|
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 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
|
252 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
|
253 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
|
254 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
255 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
|
256 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
257 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
|
258 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
259 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
|
260 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
|
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 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
|
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 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
|
265 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
266 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
|
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 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
|
269 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
|
270 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
271 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
|
272 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
273 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
|
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 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
|
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 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
|
278 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
|
279 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
280 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
|
281 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
282 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
|
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 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
|
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 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
|
287 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
|
288 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
289 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
|
290 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
291 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
|
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 += 9; |
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 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
|
296 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
|
297 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
298 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
|
299 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
|
300 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
301 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
|
302 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
|
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 /* 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
|
305 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
|
306 c++; |
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 (*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
|
309 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
|
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 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
|
312 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
313 /* 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
|
314 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
|
315 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
316 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
|
317 { |
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 == ' ') |
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 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
|
321 { |
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 += 9; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
323 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
|
324 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
325 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
|
326 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
327 /* 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
|
328 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
|
329 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
|
330 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
|
331 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
|
332 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
|
333 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
|
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 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
|
336 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
|
337 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
|
338 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
|
339 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
|
340 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
|
341 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
|
342 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
343 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
344 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
345 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
346 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
347 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
348 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
349 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
350 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
|
351 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
352 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
353 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
|
354 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
355 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
|
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 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
|
358 c++; |
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 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
|
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 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
|
363 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
364 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
|
365 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
|
366 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
|
367 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
|
368 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
|
369 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
|
370 |
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 += 8; |
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 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
|
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 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
|
376 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
|
377 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
|
378 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
379 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
|
380 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
|
381 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
|
382 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
383 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
|
384 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
|
385 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
386 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
|
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 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
|
389 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
|
390 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
391 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
392 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
393 /* 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
|
394 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
|
395 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
396 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
397 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
|
398 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
|
399 } |
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 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
402 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
403 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
|
404 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
405 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
|
406 c++; |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
407 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
408 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
409 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
|
410 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
411 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
|
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 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
|
414 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
|
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 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
|
417 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
418 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
|
419 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
|
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 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
|
422 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
423 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
|
424 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
|
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 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
|
427 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
428 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
|
429 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
|
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 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
|
432 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
433 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
|
434 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
|
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 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
|
437 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
438 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
|
439 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 else |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
442 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
|
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 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
445 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
|
446 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
447 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
448 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
|
449 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
|
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 *attributes = g_strdup_printf("FN=%s; EF=%s; CO=%s; PF=0; RL=%c", |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
452 encode_spaces(fontface), |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
453 fonteffect, fontcolor, direction); |
20983
64644b98c20c
Avoid unnecessary alloc/free.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20514
diff
changeset
|
454 *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
|
455 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
456 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
|
457 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
458 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
459 void |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
460 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
|
461 { |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
462 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
|
463 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
|
464 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
|
465 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
466 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
|
467 |
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
|
468 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
|
469 *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
|
470 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
|
471 } 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
|
472 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
|
473 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
474 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
475 *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
|
476 *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
|
477 } |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
478 |
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 * 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
|
481 ***************************************************************************/ |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
482 |
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
483 /* |
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
|
484 * 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
|
485 * 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
|
486 * 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
|
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 #define BUFSIZE 256 |
23298
5cdd93dac7a2
Delete trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
22383
diff
changeset
|
489 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
|
490 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
|
491 { |
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
|
492 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
|
493 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
|
494 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
|
495 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
|
496 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
|
497 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
|
498 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
|
499 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
|
500 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
|
501 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
|
502 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
|
503 |
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
|
504 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
|
505 |
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
|
506 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
|
507 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
|
508 |
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
|
509 /* 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
|
510 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
|
511 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
|
512 |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
513 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
|
514 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
|
515 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
|
516 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
|
517 |
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
|
518 /* 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
|
519 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
|
520 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
|
521 /* 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
|
522 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
|
523 |
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
|
524 /* & 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
|
525 /* 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
|
526 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
|
527 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
|
528 } |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
529 |
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
|
530 /* 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
|
531 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
|
532 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
|
533 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
|
534 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
|
535 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
|
536 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
|
537 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
|
538 } |
20400
ea9a5566a156
propagate from branch 'im.pidgin.rlaager.merging.msnp13-and-sf-1621854-4' (head 36b8a3e05397b5918f311a046fa580c5bb8846e0)
Richard Laager <rlaager@wiktel.com>
parents:
diff
changeset
|
539 |
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
|
540 /* 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
|
541 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
|
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 /* this is magic */ |
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 for (i = 0; i < (strlen(buf) / 4); i += 2) { |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
545 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
|
546 |
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
|
547 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
|
548 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
|
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 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
|
551 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
|
552 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
|
553 |
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
|
554 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
|
555 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
|
556 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
|
557 } |
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 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
|
559 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
|
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 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
|
562 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
|
563 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
|
564 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
|
565 |
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
|
566 /* 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
|
567 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
|
568 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
|
569 |
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 /* 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
|
571 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
|
572 |
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
|
573 /* 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
|
574 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
|
575 { |
54f7e507ea7d
Fix calculating the response to MSN Challenge strings that are an exact
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23464
diff
changeset
|
576 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
|
577 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
|
578 } |
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 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
|
581 } |
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 |