Mercurial > hg
comparison mcabber/src/jabglue.c @ 603:9516db839e08
Store subscription data
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Thu, 15 Dec 2005 12:52:37 +0100 |
parents | 483a87c99990 |
children | 0b4ed231ebc2 |
comparison
equal
deleted
inserted
replaced
602:7b20c27cae48 | 603:9516db839e08 |
---|---|
448 } | 448 } |
449 | 449 |
450 jab_send(jc, x); | 450 jab_send(jc, x); |
451 xmlnode_free(x); | 451 xmlnode_free(x); |
452 | 452 |
453 roster_add_user(cleanjid, name, group, ROSTER_TYPE_USER); | 453 roster_add_user(cleanjid, name, group, ROSTER_TYPE_USER, sub_pending); |
454 g_free(cleanjid); | 454 g_free(cleanjid); |
455 buddylist_build(); | 455 buddylist_build(); |
456 | 456 |
457 update_roster = TRUE; | 457 update_roster = TRUE; |
458 } | 458 } |
881 log_muc_conf = settings_opt_get_int("log_muc_conf"); | 881 log_muc_conf = settings_opt_get_int("log_muc_conf"); |
882 | 882 |
883 room_elt = roster_find(roomjid, jidsearch, 0); | 883 room_elt = roster_find(roomjid, jidsearch, 0); |
884 if (!room_elt) { | 884 if (!room_elt) { |
885 // Add room if it doesn't already exist | 885 // Add room if it doesn't already exist |
886 room_elt = roster_add_user(roomjid, NULL, NULL, ROSTER_TYPE_ROOM); | 886 room_elt = roster_add_user(roomjid, NULL, NULL, ROSTER_TYPE_ROOM, sub_none); |
887 } else { | 887 } else { |
888 // Make sure this is a room (it can be a conversion user->room) | 888 // Make sure this is a room (it can be a conversion user->room) |
889 buddy_settype(room_elt->data, ROSTER_TYPE_ROOM); | 889 buddy_settype(room_elt->data, ROSTER_TYPE_ROOM); |
890 } | 890 } |
891 | 891 |
1225 static void handle_packet_s10n(jconn conn, char *type, char *from, | 1225 static void handle_packet_s10n(jconn conn, char *type, char *from, |
1226 xmlnode xmldata) | 1226 xmlnode xmldata) |
1227 { | 1227 { |
1228 xmlnode x; | 1228 xmlnode x; |
1229 | 1229 |
1230 scr_LogPrint(LPRINT_LOGNORM, "Received (un)subscription packet " | |
1231 "(type=%s)", ((type) ? type : "")); | |
1232 | |
1233 if (!strcmp(type, "subscribe")) { | 1230 if (!strcmp(type, "subscribe")) { |
1234 char *r; | 1231 char *r; |
1235 int isagent; | 1232 int isagent; |
1236 r = jidtodisp(from); | 1233 r = jidtodisp(from); |
1237 isagent = (roster_gettype(r) & ROSTER_TYPE_AGENT) != 0; | 1234 isagent = (roster_gettype(r) & ROSTER_TYPE_AGENT) != 0; |
1238 g_free(r); | 1235 g_free(r); |
1239 //scr_LogPrint(LPRINT_LOGNORM, "isagent=%d", isagent); // XXX DBG | 1236 scr_LogPrint(LPRINT_LOGNORM, "<%s> wants to subscribe " |
1237 "to your network presence updates", from); | |
1240 if (!isagent) { | 1238 if (!isagent) { |
1241 scr_LogPrint(LPRINT_LOGNORM, "<%s> wants to subscribe " | |
1242 "to your network presence updates", from); | |
1243 // FIXME we accept everybody... | 1239 // FIXME we accept everybody... |
1244 x = jutil_presnew(JPACKET__SUBSCRIBED, from, 0); | 1240 x = jutil_presnew(JPACKET__SUBSCRIBED, from, 0); |
1245 jab_send(jc, x); | 1241 jab_send(jc, x); |
1246 xmlnode_free(x); | 1242 xmlnode_free(x); |
1247 } else { | 1243 } else { |
1253 x = jutil_presnew(JPACKET__UNSUBSCRIBED, from, 0); | 1249 x = jutil_presnew(JPACKET__UNSUBSCRIBED, from, 0); |
1254 jab_send(jc, x); | 1250 jab_send(jc, x); |
1255 xmlnode_free(x); | 1251 xmlnode_free(x); |
1256 scr_LogPrint(LPRINT_LOGNORM, "<%s> has unsubscribed to " | 1252 scr_LogPrint(LPRINT_LOGNORM, "<%s> has unsubscribed to " |
1257 "your presence updates", from); | 1253 "your presence updates", from); |
1254 } else if (!strcmp(type, "subscribed")) { | |
1255 scr_LogPrint(LPRINT_LOGNORM, "<%s> has subscribed to your presence " | |
1256 "updates", from); | |
1257 } else if (!strcmp(type, "unsubscribed")) { | |
1258 scr_LogPrint(LPRINT_LOGNORM, "<%s> has unsubscribed from your presence " | |
1259 "updates", from); | |
1260 } else { | |
1261 scr_LogPrint(LPRINT_LOGNORM, "Received (un)subscription packet from <%s>" | |
1262 " (type=%s)", from, (type ? type : "")); | |
1263 | |
1258 } | 1264 } |
1259 } | 1265 } |
1260 | 1266 |
1261 static void packethandler(jconn conn, jpacket packet) | 1267 static void packethandler(jconn conn, jpacket packet) |
1262 { | 1268 { |