Wed, 30 Jul 2008 03:58:21 +0000
Cleanup unnecessary casts and etc.
| 5370 | 1 | /** |
| 2 | * @file page.c Paging functions | |
| 3 | * | |
| 15884 | 4 | * purple |
| 5370 | 5 | * |
| 15884 | 6 | * Purple is the legal property of its developers, whose names are too numerous |
|
9198
e8eb6d5eb9eb
[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 |
|
e8eb6d5eb9eb
[gaim-migrate @ 9993]
Christian Hammond <chipx86@chipx86.com>
parents:
9092
diff
changeset
|
8 | * source distribution. |
|
6701
7e2db9273748
[gaim-migrate @ 7227]
Christian Hammond <chipx86@chipx86.com>
parents:
5370
diff
changeset
|
9 | * |
| 5370 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15884
diff
changeset
|
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 5370 | 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 | ||
|
22981
b83a23981419
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents:
21067
diff
changeset
|
42 | g_free(page->body); |
|
b83a23981419
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents:
21067
diff
changeset
|
43 | g_free(page->from_location); |
|
b83a23981419
Fix a number of leaks. As far as I can tell, MSNP14 now logs in without
Daniel Atallah <datallah@pidgin.im>
parents:
21067
diff
changeset
|
44 | g_free(page->from_phone); |
| 5370 | 45 | |
| 46 | g_free(page); | |
| 47 | } | |
| 48 | ||
| 49 | char * | |
|
8646
74d0e7406e3b
[gaim-migrate @ 9398]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
8475
diff
changeset
|
50 | msn_page_gen_payload(const MsnPage *page, size_t *ret_size) |
| 5370 | 51 | { |
| 52 | char *str; | |
| 53 | ||
| 54 | g_return_val_if_fail(page != NULL, NULL); | |
| 55 | ||
|
23885
92d17559f603
Properly escape text when sending MSN pages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22981
diff
changeset
|
56 | str = g_markup_printf_escaped( |
|
92d17559f603
Properly escape text when sending MSN pages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22981
diff
changeset
|
57 | "<TEXT xml:space=\"preserve\" enc=\"utf-8\">%s</TEXT>", |
|
92d17559f603
Properly escape text when sending MSN pages.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
22981
diff
changeset
|
58 | msn_page_get_body(page)); |
| 5370 | 59 | |
|
8646
74d0e7406e3b
[gaim-migrate @ 9398]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
8475
diff
changeset
|
60 | if (ret_size != NULL) |
|
9092
34b9e78827f6
[gaim-migrate @ 9869]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
8646
diff
changeset
|
61 | *ret_size = strlen(str); |
| 5370 | 62 | |
| 63 | return str; | |
| 64 | } | |
| 65 | ||
| 66 | void | |
| 67 | msn_page_set_body(MsnPage *page, const char *body) | |
| 68 | { | |
| 69 | g_return_if_fail(page != NULL); | |
| 70 | g_return_if_fail(body != NULL); | |
| 71 | ||
|
21067
97a745428ab0
Cleanup some unnecessary NULL checks in g_strdup()/g_free().
Daniel Atallah <datallah@pidgin.im>
parents:
19859
diff
changeset
|
72 | g_free(page->body); |
| 5370 | 73 | page->body = g_strdup(body); |
| 74 | } | |
| 75 | ||
| 76 | const char * | |
| 77 | msn_page_get_body(const MsnPage *page) | |
| 78 | { | |
| 79 | g_return_val_if_fail(page != NULL, NULL); | |
| 80 | ||
| 81 | return page->body; | |
| 82 | } |