annotate src/protocols/msn/page.c @ 9194:364aa73323b5

[gaim-migrate @ 9989] A few things here. First, some spelling corrections. Second, make sure we always send a group ID when we add somebody. Default to 0 if nothing else. We were sending an ADD in some cases without a group ID, and then MSN sent back a 224 - Invalid Group (I swear that never happened before?), and we misinterpreted the error and figured the passport was invalid. Third, don't spit out the "Unhandled command 'BLP'" errors. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 06 Jun 2004 03:19:41 +0000
parents 9e5a709c30a8
children ab6636c5a136
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 *
8475
06f57183e29f [gaim-migrate @ 9208]
Christian Hammond <chipx86@chipx86.com>
parents: 7468
diff changeset
6 * Copyright (C) 2003-2004 Christian Hammond <chipx86@gnupdate.org>
6701
b7e113a59b51 [gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents: 5370
diff changeset
7 *
5370
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * 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
10 * the Free Software Foundation; either version 2 of the License, or
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * (at your option) any later version.
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 *
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * GNU General Public License for more details.
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 *
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 */
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 #include "msn.h"
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 #include "page.h"
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 MsnPage *
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 msn_page_new(void)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 {
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 MsnPage *page;
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 page = g_new0(MsnPage, 1);
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 return page;
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
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 void
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 msn_page_destroy(MsnPage *page)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 {
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 g_return_if_fail(page != NULL);
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 if (page->body != NULL)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 g_free(page->body);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 if (page->from_location != NULL)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 g_free(page->from_location);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 if (page->from_phone != NULL)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 g_free(page->from_phone);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 g_free(page);
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
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 char *
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
53 msn_page_gen_payload(const MsnPage *page, size_t *ret_size)
5370
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 {
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 char *str;
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 g_return_val_if_fail(page != NULL, NULL);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
59 str =
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
60 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
61 msn_page_get_body(page));
5370
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
63 if (ret_size != NULL)
9092
9e5a709c30a8 [gaim-migrate @ 9869]
Christian Hammond <chipx86@chipx86.com>
parents: 8646
diff changeset
64 *ret_size = strlen(str);
5370
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 return str;
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
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 void
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 msn_page_set_body(MsnPage *page, const char *body)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 {
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 g_return_if_fail(page != NULL);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 g_return_if_fail(body != NULL);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74
8646
1e211dde3cae [gaim-migrate @ 9398]
Christian Hammond <chipx86@chipx86.com>
parents: 8475
diff changeset
75 if (page->body != NULL)
5370
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 g_free(page->body);
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 page->body = g_strdup(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
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 const char *
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 msn_page_get_body(const MsnPage *page)
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 {
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 g_return_val_if_fail(page != NULL, NULL);
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 return page->body;
058230cccebb [gaim-migrate @ 5746]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 }