libpurple/protocols/myspace/message.c

branch
release-2.x.y
changeset 33421
c10f36e28024
parent 30857
1a7e2da2ab01
child 35030
5eef1ddd79dc
equal deleted inserted replaced
33420:d1a5a89aa454 33421:c10f36e28024
127 /** 127 /**
128 * Create a new message from va_list and its first argument. 128 * Create a new message from va_list and its first argument.
129 * 129 *
130 * @param first_key The first argument (a key), or NULL to take all arguments 130 * @param first_key The first argument (a key), or NULL to take all arguments
131 * from argp. 131 * from argp.
132 * @param argp A va_list of variadic arguments, already started with va_start(). Will be va_end()'d. 132 * @param argp A va_list of variadic arguments, already started with va_start().
133 * @return New MsimMessage *, must be freed with msim_msg_free(). 133 * @return New MsimMessage *, must be freed with msim_msg_free().
134 * 134 *
135 * For internal use - users probably want msim_msg_new() or msim_send(). 135 * For internal use - users probably want msim_msg_new() or msim_send().
136 */ 136 */
137 static MsimMessage * 137 static MsimMessage *
209 default: 209 default:
210 purple_debug_info("msim", "msim_send: unknown type %d\n", type); 210 purple_debug_info("msim", "msim_send: unknown type %d\n", type);
211 break; 211 break;
212 } 212 }
213 } while(key); 213 } while(key);
214 va_end(argp);
215 214
216 return msg; 215 return msg;
217 } 216 }
218 217
219 /** 218 /**
225 * See msim_msg_append() documentation for details on types. 224 * See msim_msg_append() documentation for details on types.
226 */ 225 */
227 MsimMessage * 226 MsimMessage *
228 msim_msg_new(gchar *first_key, ...) 227 msim_msg_new(gchar *first_key, ...)
229 { 228 {
229 MsimMessage *ret = NULL;
230 va_list argp; 230 va_list argp;
231 231
232 if (first_key) { 232 if (first_key) {
233 va_start(argp, first_key); 233 va_start(argp, first_key);
234 return msim_msg_new_v(first_key, argp); 234 ret = msim_msg_new_v(first_key, argp);
235 } else { 235 va_end(argp);
236 return NULL; 236 }
237 } 237
238 return ret;
238 } 239 }
239 240
240 /** 241 /**
241 * Pack a string using the given GFunc and seperator. 242 * Pack a string using the given GFunc and seperator.
242 * Used by msim_msg_dump() and msim_msg_pack(). 243 * Used by msim_msg_dump() and msim_msg_pack().
958 MsimMessage *msg; 959 MsimMessage *msg;
959 va_list argp; 960 va_list argp;
960 961
961 va_start(argp, session); 962 va_start(argp, session);
962 msg = msim_msg_new_v(NULL, argp); 963 msg = msim_msg_new_v(NULL, argp);
964 va_end(argp);
963 965
964 /* Actually send the message. */ 966 /* Actually send the message. */
965 success = msim_msg_send(session, msg); 967 success = msim_msg_send(session, msg);
966 968
967 /* Cleanup. */ 969 /* Cleanup. */

mercurial