929 |
929 |
930 jab_send(conn, x); |
930 jab_send(conn, x); |
931 xmlnode_free(x); |
931 xmlnode_free(x); |
932 } |
932 } |
933 |
933 |
|
934 // FIXME highly duplicated code |
|
935 static void send_iq_not_available(jconn conn, char *from, xmlnode xmldata) |
|
936 { |
|
937 xmlnode x, y, z; |
|
938 // Not available. |
|
939 x = xmlnode_dup(xmldata); |
|
940 xmlnode_put_attrib(x, "to", xmlnode_get_attrib(xmldata, "from")); |
|
941 xmlnode_hide_attrib(x, "from"); |
|
942 |
|
943 xmlnode_put_attrib(x, "type", TMSG_ERROR); |
|
944 y = xmlnode_insert_tag(x, TMSG_ERROR); |
|
945 xmlnode_put_attrib(y, "code", "503"); |
|
946 xmlnode_put_attrib(y, "type", "cancel"); |
|
947 z = xmlnode_insert_tag(y, "service-unavailable"); |
|
948 xmlnode_put_attrib(z, "xmlns", NS_XMPP_STANZAS); |
|
949 |
|
950 jab_send(conn, x); |
|
951 xmlnode_free(x); |
|
952 } |
|
953 |
934 /* |
954 /* |
935 static void send_iq_commands_bad_action(jconn conn, char *from, xmlnode xmldata) |
955 static void send_iq_commands_bad_action(jconn conn, char *from, xmlnode xmldata) |
936 { |
956 { |
937 xmlnode x, y, z; |
957 xmlnode x, y, z; |
938 |
958 |
1521 handle_iq_disco_info(conn, from, id, xmldata); |
1541 handle_iq_disco_info(conn, from, id, xmldata); |
1522 } else if (ns && !strcmp(ns, NS_DISCO_ITEMS)) { |
1542 } else if (ns && !strcmp(ns, NS_DISCO_ITEMS)) { |
1523 handle_iq_disco_items(conn, from, id, xmldata); |
1543 handle_iq_disco_items(conn, from, id, xmldata); |
1524 } else if (ns && !strcmp(ns, NS_VERSION)) { |
1544 } else if (ns && !strcmp(ns, NS_VERSION)) { |
1525 handle_iq_version(conn, from, id, xmldata); |
1545 handle_iq_version(conn, from, id, xmldata); |
1526 } else if (ns && !strcmp(ns, NS_LAST) && |
1546 } else if (ns && !strcmp(ns, NS_LAST)) { |
1527 !settings_opt_get_int("iq_last_disable")) { |
1547 if (!settings_opt_get_int("iq_last_disable") && |
1528 handle_iq_last(conn, from, id, xmldata); |
1548 (!settings_opt_get_int("iq_last_disable_when_notavail") || |
|
1549 jb_getstatus() != notavail)) |
|
1550 handle_iq_last(conn, from, id, xmldata); |
|
1551 else |
|
1552 send_iq_not_available(conn, from, xmldata); |
1529 } else if (ns && !strcmp(ns, NS_TIME)) { |
1553 } else if (ns && !strcmp(ns, NS_TIME)) { |
1530 handle_iq_time(conn, from, id, xmldata); |
1554 handle_iq_time(conn, from, id, xmldata); |
1531 } else { |
1555 } else { |
1532 iq_not_implemented = TRUE; |
1556 iq_not_implemented = TRUE; |
1533 } |
1557 } |