Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/jabglue.c @ 1395:d431cd75eb53
Use bookmarked nickname when manually joining a room
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Mon, 10 Dec 2007 21:45:24 +0100 |
parents | 7ca57f7e313c |
children | 8f9928839a36 |
comparison
equal
deleted
inserted
replaced
1394:bba74a50dedf | 1395:d431cd75eb53 |
---|---|
1350 jab_send(jc, x); | 1350 jab_send(jc, x); |
1351 xmlnode_free(x); | 1351 xmlnode_free(x); |
1352 jb_reset_keepalive(); | 1352 jb_reset_keepalive(); |
1353 } | 1353 } |
1354 | 1354 |
1355 // jb_is_bookmarked() | 1355 // jb_is_bookmarked(roomjid) |
1356 // Return TRUE if there's a bookmark for the given jid. | 1356 // Return TRUE if there's a bookmark for the given jid. |
1357 guint jb_is_bookmarked(const char *bjid) | 1357 guint jb_is_bookmarked(const char *bjid) |
1358 { | 1358 { |
1359 xmlnode x; | 1359 xmlnode x; |
1360 | 1360 |
1374 return TRUE; | 1374 return TRUE; |
1375 } | 1375 } |
1376 } | 1376 } |
1377 return FALSE; | 1377 return FALSE; |
1378 } | 1378 } |
1379 | |
1380 // jb_get_bookmark_nick(roomjid) | |
1381 // Return the room nickname if it is present in a bookmark. | |
1382 const char *jb_get_bookmark_nick(const char *bjid) | |
1383 { | |
1384 xmlnode x; | |
1385 | |
1386 if (!bookmarks || !bjid) | |
1387 return NULL; | |
1388 | |
1389 // Walk through the storage bookmark tags | |
1390 x = xmlnode_get_firstchild(bookmarks); | |
1391 for ( ; x; x = xmlnode_get_nextsibling(x)) { | |
1392 const char *fjid; | |
1393 const char *p; | |
1394 p = xmlnode_get_name(x); | |
1395 // If the node is a conference item, check the jid. | |
1396 if (p && !strcmp(p, "conference")) { | |
1397 fjid = xmlnode_get_attrib(x, "jid"); | |
1398 if (fjid && !strcasecmp(bjid, fjid)) | |
1399 return xmlnode_get_tag_data(x, "nick"); | |
1400 } | |
1401 } | |
1402 return NULL; | |
1403 } | |
1404 | |
1379 | 1405 |
1380 // jb_get_all_storage_bookmarks() | 1406 // jb_get_all_storage_bookmarks() |
1381 // Return a GSList with all storage bookmarks. | 1407 // Return a GSList with all storage bookmarks. |
1382 // The caller should g_free the list (not the MUC jids). | 1408 // The caller should g_free the list (not the MUC jids). |
1383 GSList *jb_get_all_storage_bookmarks(void) | 1409 GSList *jb_get_all_storage_bookmarks(void) |
2788 goto evscallback_invitation_free; | 2814 goto evscallback_invitation_free; |
2789 // Ok, let's work now. | 2815 // Ok, let's work now. |
2790 // evcontext: 0, 1 == reject, accept | 2816 // evcontext: 0, 1 == reject, accept |
2791 | 2817 |
2792 if (evcontext & ~EVS_CONTEXT_USER) { | 2818 if (evcontext & ~EVS_CONTEXT_USER) { |
2793 char *nickname = default_muc_nickname(); | 2819 char *nickname = default_muc_nickname(invitation->to); |
2794 jb_room_join(invitation->to, nickname, invitation->passwd); | 2820 jb_room_join(invitation->to, nickname, invitation->passwd); |
2795 g_free(nickname); | 2821 g_free(nickname); |
2796 } else { | 2822 } else { |
2797 scr_LogPrint(LPRINT_LOGNORM, "Invitation to %s refused.", invitation->to); | 2823 scr_LogPrint(LPRINT_LOGNORM, "Invitation to %s refused.", invitation->to); |
2798 decline_invitation(invitation, NULL); | 2824 decline_invitation(invitation, NULL); |