comparison libpurple/protocols/msnp9/page.c @ 21312:a07cfce78345

Add MSNP9 back as an alternative alongside the existing MSN prpl. Cowardly old fools like me who prefer the stability of our MSNP9 code over the features of MSNP14 can enable this using the --disable-msnp14 ./configure option. If we want to release from i.p.p and MSN stability is the only blocker, we can trivially flick the default to use MSNP9 in configure.ac
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 11 Nov 2007 12:57:52 +0000
parents
children
comparison
equal deleted inserted replaced
21311:7d031cec5ba2 21312:a07cfce78345
1 /**
2 * @file page.c Paging functions
3 *
4 * purple
5 *
6 * Purple is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * source distribution.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 */
24 #include "msn.h"
25 #include "page.h"
26
27 MsnPage *
28 msn_page_new(void)
29 {
30 MsnPage *page;
31
32 page = g_new0(MsnPage, 1);
33
34 return page;
35 }
36
37 void
38 msn_page_destroy(MsnPage *page)
39 {
40 g_return_if_fail(page != NULL);
41
42 if (page->body != NULL)
43 g_free(page->body);
44
45 if (page->from_location != NULL)
46 g_free(page->from_location);
47
48 if (page->from_phone != NULL)
49 g_free(page->from_phone);
50
51 g_free(page);
52 }
53
54 char *
55 msn_page_gen_payload(const MsnPage *page, size_t *ret_size)
56 {
57 char *str;
58
59 g_return_val_if_fail(page != NULL, NULL);
60
61 str =
62 g_strdup_printf("<TEXT xml:space=\"preserve\" enc=\"utf-8\">%s</TEXT>",
63 msn_page_get_body(page));
64
65 if (ret_size != NULL)
66 *ret_size = strlen(str);
67
68 return str;
69 }
70
71 void
72 msn_page_set_body(MsnPage *page, const char *body)
73 {
74 g_return_if_fail(page != NULL);
75 g_return_if_fail(body != NULL);
76
77 if (page->body != NULL)
78 g_free(page->body);
79
80 page->body = g_strdup(body);
81 }
82
83 const char *
84 msn_page_get_body(const MsnPage *page)
85 {
86 g_return_val_if_fail(page != NULL, NULL);
87
88 return page->body;
89 }