| |
1 /** |
| |
2 * @file page.h Paging functions |
| |
3 * |
| |
4 * gaim |
| |
5 * |
| |
6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org> |
| |
7 * |
| |
8 * This program is free software; you can redistribute it and/or modify |
| |
9 * it under the terms of the GNU General Public License as published by |
| |
10 * the Free Software Foundation; either version 2 of the License, or |
| |
11 * (at your option) any later version. |
| |
12 * |
| |
13 * This program is distributed in the hope that it will be useful, |
| |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| |
16 * GNU General Public License for more details. |
| |
17 * |
| |
18 * You should have received a copy of the GNU General Public License |
| |
19 * along with this program; if not, write to the Free Software |
| |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| |
21 */ |
| |
22 #ifndef _MSN_PAGE_H_ |
| |
23 #define _MSN_PAGE_H_ |
| |
24 |
| |
25 typedef struct _MsnPage MsnPage; |
| |
26 |
| |
27 #include "session.h" |
| |
28 #include "user.h" |
| |
29 |
| |
30 /** |
| |
31 * A page. |
| |
32 */ |
| |
33 struct _MsnPage |
| |
34 { |
| |
35 MsnUser *sender; |
| |
36 MsnUser *receiver; |
| |
37 |
| |
38 char *from_location; |
| |
39 char *from_phone; |
| |
40 |
| |
41 gboolean incoming; |
| |
42 |
| |
43 unsigned int trId; |
| |
44 |
| |
45 size_t size; |
| |
46 |
| |
47 char *body; |
| |
48 }; |
| |
49 |
| |
50 /** |
| |
51 * Creates a new, empty page. |
| |
52 * |
| |
53 * @return A new page. |
| |
54 */ |
| |
55 MsnPage *msn_page_new(void); |
| |
56 |
| |
57 /** |
| |
58 * Creates a new page based off a string. |
| |
59 * |
| |
60 * @param session The MSN session. |
| |
61 * @param str The string. |
| |
62 * |
| |
63 * @return The new page. |
| |
64 */ |
| |
65 MsnPage *msn_page_new_from_str(MsnSession *session, const char *str); |
| |
66 |
| |
67 /** |
| |
68 * Destroys a page. |
| |
69 */ |
| |
70 void msn_page_destroy(MsnPage *page); |
| |
71 |
| |
72 /** |
| |
73 * Converts a page to a string. |
| |
74 * |
| |
75 * @param page The page. |
| |
76 * |
| |
77 * @return The string representation of a page. |
| |
78 */ |
| |
79 char *msn_page_build_string(const MsnPage *page); |
| |
80 |
| |
81 /** |
| |
82 * Returns TRUE if the page is outgoing. |
| |
83 * |
| |
84 * @param page The page. |
| |
85 * |
| |
86 * @return @c TRUE if the page is outgoing, or @c FALSE otherwise. |
| |
87 */ |
| |
88 gboolean msn_page_is_outgoing(const MsnPage *page); |
| |
89 |
| |
90 /** |
| |
91 * Returns TRUE if the page is incoming. |
| |
92 * |
| |
93 * @param page The page. |
| |
94 * |
| |
95 * @return @c TRUE if the page is incoming, or @c FALSE otherwise. |
| |
96 */ |
| |
97 gboolean msn_page_is_incoming(const MsnPage *page); |
| |
98 |
| |
99 /** |
| |
100 * Sets the page's sender. |
| |
101 * |
| |
102 * @param page The page. |
| |
103 * @param user The sender. |
| |
104 */ |
| |
105 void msn_page_set_sender(MsnPage *page, MsnUser *user); |
| |
106 |
| |
107 /** |
| |
108 * Returns the page's sender. |
| |
109 * |
| |
110 * @param page The page. |
| |
111 * |
| |
112 * @return The sender. |
| |
113 */ |
| |
114 MsnUser *msn_page_get_sender(const MsnPage *page); |
| |
115 |
| |
116 /** |
| |
117 * Sets the page's receiver. |
| |
118 * |
| |
119 * @param page The page. |
| |
120 * @param user The receiver. |
| |
121 */ |
| |
122 void msn_page_set_receiver(MsnPage *page, MsnUser *user); |
| |
123 |
| |
124 /** |
| |
125 * Returns the page's receiver. |
| |
126 * |
| |
127 * @param page The page. |
| |
128 * |
| |
129 * @return The receiver. |
| |
130 */ |
| |
131 MsnUser *msn_page_get_receiver(const MsnPage *page); |
| |
132 |
| |
133 /** |
| |
134 * Sets the page transaction ID. |
| |
135 * |
| |
136 * @param page The page. |
| |
137 * @param tid The transaction ID. |
| |
138 */ |
| |
139 void msn_page_set_transaction_id(MsnPage *page, unsigned int tid); |
| |
140 |
| |
141 /** |
| |
142 * Returns the page transaction ID. |
| |
143 * |
| |
144 * @param page The page. |
| |
145 * |
| |
146 * @return The transaction ID. |
| |
147 */ |
| |
148 unsigned int msn_page_get_transaction_id(const MsnPage *page); |
| |
149 |
| |
150 |
| |
151 /** |
| |
152 * Sets the body of a page. |
| |
153 * |
| |
154 * @param page The page. |
| |
155 * @param body The body of the page. |
| |
156 */ |
| |
157 void msn_page_set_body(MsnPage *page, const char *body); |
| |
158 |
| |
159 /** |
| |
160 * Returns the body of the page. |
| |
161 * |
| |
162 * @param page The page. |
| |
163 * |
| |
164 * @return The body of the page. |
| |
165 */ |
| |
166 const char *msn_page_get_body(const MsnPage *page); |
| |
167 |
| |
168 #endif /* _MSN_PAGE_H_ */ |