libpurple/protocols/mxit/formcmds.c

branch
mxit
changeset 32170
1d5f4a7a0790
parent 31804
847a13d5d3bb
child 32330
e986fbe117b5
child 32438
dc8991868906
equal deleted inserted replaced
32169:b500edda2f55 32170:1d5f4a7a0790
251 } 251 }
252 252
253 253
254 /*------------------------------------------------------------------------ 254 /*------------------------------------------------------------------------
255 * Process a Reply MXit command. 255 * Process a Reply MXit command.
256 * [::op=cmd|type=reply|replymsg=back|selmsg=b) Back|id=12345:] 256 * [::op=cmd|type=reply|replymsg=back|selmsg=b) Back|displaymsg=Processing|id=12345:]
257 * [::op=cmd|nm=rep|type=reply|replymsg=back|selmsg=b) Back|id=12345:] 257 * [::op=cmd|nm=rep|type=reply|replymsg=back|selmsg=b) Back|displaymsg=Processing|id=12345:]
258 * 258 *
259 * @param mx The received message data object 259 * @param mx The received message data object
260 * @param hash The MXit command <key,value> map 260 * @param hash The MXit command <key,value> map
261 */ 261 */
262 static void command_reply(struct RXMsgData* mx, GHashTable* hash) 262 static void command_reply(struct RXMsgData* mx, GHashTable* hash)
263 { 263 {
264 char* replymsg; 264 char* replymsg;
265 char* selmsg; 265 char* selmsg;
266 char* nm; 266 char* nm;
267 267
268 selmsg = g_hash_table_lookup(hash, "selmsg"); /* find the selection message */ 268 selmsg = g_hash_table_lookup(hash, "selmsg"); /* selection message */
269 replymsg = g_hash_table_lookup(hash, "replymsg"); /* find the reply message */ 269 replymsg = g_hash_table_lookup(hash, "replymsg"); /* reply message */
270 nm = g_hash_table_lookup(hash, "nm"); /* name parameter */ 270 nm = g_hash_table_lookup(hash, "nm"); /* name parameter */
271 if ((selmsg) && (replymsg) && (nm)) { 271
272 if ((selmsg == NULL) || (replymsg == NULL))
273 return; /* these parameters are required */
274
275 if (nm) { /* indicates response must be a structured response */
272 gchar* seltext = g_markup_escape_text(purple_url_decode(selmsg), -1); 276 gchar* seltext = g_markup_escape_text(purple_url_decode(selmsg), -1);
273 gchar* replycmd = g_strdup_printf("::type=reply|nm=%s|res=%s|err=0:", nm, replymsg); 277 gchar* replycmd = g_strdup_printf("type=reply|nm=%s|res=%s|err=0", nm, replymsg);
274 278
275 mxit_add_html_link( mx, replycmd, seltext ); 279 mxit_add_html_link( mx, replycmd, TRUE, seltext );
276 280
277 g_free(seltext); 281 g_free(seltext);
278 g_free(replycmd); 282 g_free(replycmd);
279 } 283 }
280 else if ((selmsg) && (replymsg)) { 284 else {
281 gchar* seltext = g_markup_escape_text(purple_url_decode(selmsg), -1); 285 gchar* seltext = g_markup_escape_text(purple_url_decode(selmsg), -1);
282 286
283 mxit_add_html_link( mx, purple_url_decode(replymsg), seltext ); 287 mxit_add_html_link( mx, purple_url_decode(replymsg), FALSE, seltext );
284 288
285 g_free(seltext); 289 g_free(seltext);
286 } 290 }
287 } 291 }
288 292
315 } 319 }
316 320
317 321
318 /*------------------------------------------------------------------------ 322 /*------------------------------------------------------------------------
319 * Process an inline image MXit command. 323 * Process an inline image MXit command.
324 * [::op=img|dat=ASDF23408asdflkj2309flkjsadf%3d%3d|algn=1|w=120|h=12|t=100|replymsg=text:]
320 * 325 *
321 * @param mx The received message data object 326 * @param mx The received message data object
322 * @param hash The MXit command <key,value> map 327 * @param hash The MXit command <key,value> map
323 * @param msg The message to display (as generated so far) 328 * @param msg The message to display (as generated so far)
324 */ 329 */
370 375
371 /* if this is a clickable image, show a click link */ 376 /* if this is a clickable image, show a click link */
372 reply = g_hash_table_lookup(hash, "replymsg"); 377 reply = g_hash_table_lookup(hash, "replymsg");
373 if (reply) { 378 if (reply) {
374 g_string_append_printf(msg, "\n"); 379 g_string_append_printf(msg, "\n");
375 mxit_add_html_link(mx, reply, _( "click here" )); 380 mxit_add_html_link(mx, reply, FALSE, _( "click here" ));
376 } 381 }
377 } 382 }
378 383
379 384
380 /*------------------------------------------------------------------------ 385 /*------------------------------------------------------------------------

mercurial