comparison src/protocols/msn/msg.h @ 5309:e2e53316a21d

[gaim-migrate @ 5681] Announcing the new MSN prpl! It probably has some bugs, and for the time being, there is no file transfer. That's good though, because the current MSN file transfer is a little broken. I've had many corrupted files. I'll commit new file transfer code when it's written. I want this heavily tested before 0.63! If you use MSN, please talk to people on it. Let me know of any oddities, crashes, bugs, whatever. I'll fix things as I find them. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 06 May 2003 02:06:56 +0000
parents 86b0a0243be8
children 4f72b611f0ee
comparison
equal deleted inserted replaced
5308:6aa785e55d0f 5309:e2e53316a21d
1 /** 1 /**
2 * @file msg.h Message functions 2 * @file msg.h Message functions
3 * 3 *
4 * gaim 4 * gaim
5 * 5 *
6 * Copyright (C) 2003, Christian Hammond <chipx86@gnupdate.org> 6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 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 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 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 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 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */ 21 */
23 #ifndef _MSN_MSG_H_ 22 #ifndef _MSN_MSG_H_
24 #define _MSN_MSG_H_ 23 #define _MSN_MSG_H_
25 24
26 /** 25 typedef struct _MsnMessage MsnMessage;
27 * Writes a message to the server. 26
28 * 27 #include "session.h"
29 * @param fd The file descriptor. 28 #include "user.h"
30 * @param data The data to write. 29
31 * @param len The length of the data 30 /**
32 * 31 * A message.
33 * @return The number of bytes written. 32 */
34 */ 33 struct _MsnMessage
35 int msn_write(int fd, void *data, int len); 34 {
35 MsnUser *sender;
36 MsnUser *receiver;
37
38 unsigned int tid;
39 char flag;
40
41 gboolean incoming;
42
43 size_t size;
44
45 char *content_type;
46 char *charset;
47 char *body;
48
49 GHashTable *attr_table;
50 GList *attr_list;
51 };
52
53 /**
54 * Creates a new, empty message.
55 *
56 * @return A new message.
57 */
58 MsnMessage *msn_message_new(void);
59
60 /**
61 * Creates a new message based off a string.
62 *
63 * @param session The MSN session.
64 * @param str The string.
65 *
66 * @return The new message.
67 */
68 MsnMessage *msn_message_new_from_str(MsnSession *session, const char *str);
69
70 /**
71 * Destroys a message.
72 */
73 void msn_message_destroy(MsnMessage *msg);
74
75 /**
76 * Converts a message to a string.
77 *
78 * @param msg The message.
79 *
80 * @return The string representation of a message.
81 */
82 char *msn_message_build_string(const MsnMessage *msg);
83
84 /**
85 * Returns TRUE if the message is outgoing.
86 *
87 * @param msg The message.
88 *
89 * @return @c TRUE if the message is outgoing, or @c FALSE otherwise.
90 */
91 gboolean msn_message_is_outgoing(const MsnMessage *msg);
92
93 /**
94 * Returns TRUE if the message is incoming.
95 *
96 * @param msg The message.
97 *
98 * @return @c TRUE if the message is incoming, or @c FALSE otherwise.
99 */
100 gboolean msn_message_is_incoming(const MsnMessage *msg);
101
102 /**
103 * Sets the message's sender.
104 *
105 * @param msg The message.
106 * @param user The sender.
107 */
108 void msn_message_set_sender(MsnMessage *msg, MsnUser *user);
109
110 /**
111 * Returns the message's sender.
112 *
113 * @param msg The message.
114 *
115 * @return The sender.
116 */
117 MsnUser *msn_message_get_sender(const MsnMessage *msg);
118
119 /**
120 * Sets the message's receiver.
121 *
122 * @param msg The message.
123 * @param user The receiver.
124 */
125 void msn_message_set_receiver(MsnMessage *msg, MsnUser *user);
126
127 /**
128 * Returns the message's receiver.
129 *
130 * @param msg The message.
131 *
132 * @return The receiver.
133 */
134 MsnUser *msn_message_get_receiver(const MsnMessage *msg);
135
136 /**
137 * Sets the message transaction ID.
138 *
139 * @param msg The message.
140 * @param tid The transaction ID.
141 */
142 void msn_message_set_transaction_id(MsnMessage *msg, unsigned int tid);
143
144 /**
145 * Returns the message transaction ID.
146 *
147 * @param msg The message.
148 *
149 * @return The transaction ID.
150 */
151 unsigned int msn_message_get_transaction_id(const MsnMessage *msg);
152
153 /**
154 * Sets the flag for an outgoing message.
155 *
156 * @param msg The message.
157 * @param flag The flag.
158 */
159 void msn_message_set_flag(MsnMessage *msg, char flag);
160
161 /**
162 * Returns the flag for an outgoing message.
163 *
164 * @param msg The message.
165 *
166 * @return The flag.
167 */
168 char msn_message_get_flag(const MsnMessage *msg);
169
170 /**
171 * Sets the body of a message.
172 *
173 * @param msg The message.
174 * @param body The body of the message.
175 */
176 void msn_message_set_body(MsnMessage *msg, const char *body);
177
178 /**
179 * Returns the body of the message.
180 *
181 * @param msg The message.
182 *
183 * @return The body of the message.
184 */
185 const char *msn_message_get_body(const MsnMessage *msg);
186
187 /**
188 * Sets the content type in a message.
189 *
190 * @param msg The message.
191 * @param type The content-type.
192 */
193 void msn_message_set_content_type(MsnMessage *msg, const char *type);
194
195 /**
196 * Returns the content type in a message.
197 *
198 * @param msg The message.
199 *
200 * @return The content-type.
201 */
202 const char *msn_message_get_content_type(const MsnMessage *msg);
203
204 /**
205 * Sets the charset in a message.
206 *
207 * @param msg The message.
208 * @param charset The charset.
209 */
210 void msn_message_set_charset(MsnMessage *msg, const char *charset);
211
212 /**
213 * Returns the charset in a message.
214 *
215 * @param msg The message.
216 *
217 * @return The charset.
218 */
219 const char *msn_message_get_charset(const MsnMessage *msg);
220
221 /**
222 * Sets an attribute in a message.
223 *
224 * @param msg The message.
225 * @param attr The attribute name.
226 * @param value The attribute value.
227 */
228 void msn_message_set_attr(MsnMessage *msg, const char *attr,
229 const char *value);
230
231 /**
232 * Returns an attribute from a message.
233 *
234 * @param msg The message.
235 * @param attr The attribute.
236 *
237 * @return The value, or @c NULL if not found.
238 */
239 const char *msn_message_get_attr(const MsnMessage *msg, const char *attr);
240
241 /**
242 * Parses the body and returns it in the form of a hashtable.
243 *
244 * @param msg The message.
245 *
246 * @return The resulting hashtable.
247 */
248 GHashTable *msn_message_get_hashtable_from_body(const MsnMessage *msg);
36 249
37 #endif /* _MSN_MSG_H_ */ 250 #endif /* _MSN_MSG_H_ */