comparison mcabber/src/jabglue.c @ 1378:61fc9eddf763

Small code cleanup
author Mikael Berthe <mikael@lilotux.net>
date Wed, 28 Nov 2007 22:42:48 +0100
parents cd9182f0b5c7
children 74b7621537d7
comparison
equal deleted inserted replaced
1377:cd9182f0b5c7 1378:61fc9eddf763
46 46
47 char imstatus2char[imstatus_size+1] = { 47 char imstatus2char[imstatus_size+1] = {
48 '_', 'o', 'f', 'd', 'n', 'a', 'i', '\0' 48 '_', 'o', 'f', 'd', 'n', 'a', 'i', '\0'
49 }; 49 };
50 50
51 static char *imstatus_showmap[] = {
52 "",
53 "",
54 "chat",
55 "dnd",
56 "xa",
57 "away",
58 ""
59 };
60
51 static time_t LastPingTime; 61 static time_t LastPingTime;
52 static unsigned int KeepaliveDelay; 62 static unsigned int KeepaliveDelay;
53 static enum imstatus mystatus = offline; 63 static enum imstatus mystatus = offline;
54 static enum imstatus mywantedstatus = available; 64 static enum imstatus mywantedstatus = available;
55 static gchar *mystatusmsg; 65 static gchar *mystatusmsg;
399 xmlnode_put_attrib(x, "to", recipient); 409 xmlnode_put_attrib(x, "to", recipient);
400 } 410 }
401 411
402 switch(st) { 412 switch(st) {
403 case away: 413 case away:
404 xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"), "away", 414 case notavail:
405 (unsigned) -1);
406 break;
407
408 case dontdisturb: 415 case dontdisturb:
409 xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"), "dnd",
410 (unsigned) -1);
411 break;
412
413 case freeforchat: 416 case freeforchat:
414 xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"), "chat", 417 xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"),
415 (unsigned) -1); 418 imstatus_showmap[st], (unsigned) -1);
416 break;
417
418 case notavail:
419 xmlnode_insert_cdata(xmlnode_insert_tag(x, "show"), "xa",
420 (unsigned) -1);
421 break; 419 break;
422 420
423 case invisible: 421 case invisible:
424 xmlnode_put_attrib(x, "type", "invisible"); 422 xmlnode_put_attrib(x, "type", "invisible");
425 break; 423 break;
686 #ifdef JEP0085 684 #ifdef JEP0085
687 /* JEP-0085 5.1 685 /* JEP-0085 5.1
688 * "Until receiving a reply to the initial content message (or a standalone 686 * "Until receiving a reply to the initial content message (or a standalone
689 * notification) from the Contact, the User MUST NOT send subsequent chat 687 * notification) from the Contact, the User MUST NOT send subsequent chat
690 * state notifications to the Contact." 688 * state notifications to the Contact."
691 * In our implementation support is initially "unknown", they it's "probed" 689 * In our implementation support is initially "unknown", then it's "probed"
692 * and can become "ok". 690 * and can become "ok".
693 */ 691 */
694 if (jep85 && (jep85->support == CHATSTATES_SUPPORT_OK || 692 if (jep85 && (jep85->support == CHATSTATES_SUPPORT_OK ||
695 jep85->support == CHATSTATES_SUPPORT_UNKNOWN)) { 693 jep85->support == CHATSTATES_SUPPORT_UNKNOWN)) {
696 event = xmlnode_insert_tag(x, "active"); 694 event = xmlnode_insert_tag(x, "active");