annotate src/protocols/msn/page.c @ 10092:1843023b8189

[gaim-migrate @ 11109] This fixes the crash after signon on MSN when you have Miranda users on your buddy list. I also tidied up the printing of SLP debug info when it's enabled, but it's not enabled unless you explicitly enable it, so you probably won't notice. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Wed, 13 Oct 2004 14:40:45 +0000
parents ab6636c5a136
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5370
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file page.c Paging functions
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 * gaim
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
9198
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9092
diff changeset
6 * Gaim is the legal property of its developers, whose names are too numerous
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9092
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
ab6636c5a136 [gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents: 9092
diff changeset
8 * source distribution.
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5370
diff changeset
9 *
5370
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * (at your option) any later version.
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 *
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * GNU General Public License for more details.
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 *
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 */
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 #include "msn.h"
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #include "page.h"
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 MsnPage *
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 msn_page_new(void)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 {
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 MsnPage *page;
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 page = g_new0(MsnPage, 1);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 return page;
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 }
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 void
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 msn_page_destroy(MsnPage *page)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 {
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 g_return_if_fail(page != NULL);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 if (page->body != NULL)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 g_free(page->body);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 if (page->from_location != NULL)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 g_free(page->from_location);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 if (page->from_phone != NULL)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 g_free(page->from_phone);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 g_free(page);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 }
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 char *
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
55 msn_page_gen_payload(const MsnPage *page, size_t *ret_size)
5370
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 {
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 char *str;
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 g_return_val_if_fail(page != NULL, NULL);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
61 str =
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
62 g_strdup_printf("<TEXT xml:space=\"preserve\" enc=\"utf-8\">%s</TEXT>",
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
63 msn_page_get_body(page));
5370
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
65 if (ret_size != NULL)
9092
9e5a709c30a8 [gaim-migrate @ 9869]
Christian Hammond <chipx86@chipx86.com>
parents: 8646
diff changeset
66 *ret_size = strlen(str);
5370
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 return str;
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 }
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 void
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 msn_page_set_body(MsnPage *page, const char *body)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 {
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 g_return_if_fail(page != NULL);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 g_return_if_fail(body != NULL);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
77 if (page->body != NULL)
5370
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 g_free(page->body);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 page->body = g_strdup(body);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 }
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 const char *
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 msn_page_get_body(const MsnPage *page)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 {
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 g_return_val_if_fail(page != NULL, NULL);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88 return page->body;
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 }