mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Rename Bookmark->jid to Bookmark->barejid
This commit is contained in:
parent
6a18dedca8
commit
ea98a8b04a
@ -698,10 +698,10 @@ cons_show_bookmarks(const GList *list)
|
|||||||
|
|
||||||
theme_item_t presence_colour = THEME_TEXT;
|
theme_item_t presence_colour = THEME_TEXT;
|
||||||
|
|
||||||
if (muc_active(item->jid)) {
|
if (muc_active(item->barejid)) {
|
||||||
presence_colour = THEME_ONLINE;
|
presence_colour = THEME_ONLINE;
|
||||||
}
|
}
|
||||||
win_vprint(console, '-', 0, NULL, NO_EOL, presence_colour, "", " %s", item->jid);
|
win_vprint(console, '-', 0, NULL, NO_EOL, presence_colour, "", " %s", item->barejid);
|
||||||
if (item->nick) {
|
if (item->nick) {
|
||||||
win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", "/%s", item->nick);
|
win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", "/%s", item->nick);
|
||||||
}
|
}
|
||||||
@ -711,8 +711,8 @@ cons_show_bookmarks(const GList *list)
|
|||||||
if (item->password) {
|
if (item->password) {
|
||||||
win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " (private)");
|
win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " (private)");
|
||||||
}
|
}
|
||||||
if (muc_active(item->jid)) {
|
if (muc_active(item->barejid)) {
|
||||||
ProfWin *roomwin = (ProfWin*)wins_get_muc(item->jid);
|
ProfWin *roomwin = (ProfWin*)wins_get_muc(item->barejid);
|
||||||
if (roomwin) {
|
if (roomwin) {
|
||||||
int num = wins_get_num(roomwin);
|
int num = wins_get_num(roomwin);
|
||||||
win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " (win %d)", num);
|
win_vprint(console, '-', 0, NULL, NO_DATE | NO_EOL, presence_colour, "", " (win %d)", num);
|
||||||
|
@ -103,7 +103,7 @@ bookmark_add(const char *jid, const char *nick, const char *password, const char
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bookmark *bookmark = malloc(sizeof(Bookmark));
|
Bookmark *bookmark = malloc(sizeof(Bookmark));
|
||||||
bookmark->jid = strdup(jid);
|
bookmark->barejid = strdup(jid);
|
||||||
if (nick) {
|
if (nick) {
|
||||||
bookmark->nick = strdup(nick);
|
bookmark->nick = strdup(nick);
|
||||||
} else {
|
} else {
|
||||||
@ -171,16 +171,16 @@ bookmark_join(const char *jid)
|
|||||||
|
|
||||||
char *account_name = session_get_account_name();
|
char *account_name = session_get_account_name();
|
||||||
ProfAccount *account = accounts_get_account(account_name);
|
ProfAccount *account = accounts_get_account(account_name);
|
||||||
if (!muc_active(bookmark->jid)) {
|
if (!muc_active(bookmark->barejid)) {
|
||||||
char *nick = bookmark->nick;
|
char *nick = bookmark->nick;
|
||||||
if (!nick) {
|
if (!nick) {
|
||||||
nick = account->muc_nick;
|
nick = account->muc_nick;
|
||||||
}
|
}
|
||||||
presence_join_room(bookmark->jid, nick, bookmark->password);
|
presence_join_room(bookmark->barejid, nick, bookmark->password);
|
||||||
muc_join(bookmark->jid, nick, bookmark->password, FALSE);
|
muc_join(bookmark->barejid, nick, bookmark->password, FALSE);
|
||||||
account_free(account);
|
account_free(account);
|
||||||
} else if (muc_roster_complete(bookmark->jid)) {
|
} else if (muc_roster_complete(bookmark->barejid)) {
|
||||||
ui_room_join(bookmark->jid, TRUE);
|
ui_room_join(bookmark->barejid, TRUE);
|
||||||
account_free(account);
|
account_free(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,13 +259,13 @@ _bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
|
|||||||
child = xmpp_stanza_get_next(child);
|
child = xmpp_stanza_get_next(child);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const char *jid = xmpp_stanza_get_attribute(child, STANZA_ATTR_JID);
|
const char *barejid = xmpp_stanza_get_attribute(child, STANZA_ATTR_JID);
|
||||||
if (!jid) {
|
if (!barejid) {
|
||||||
child = xmpp_stanza_get_next(child);
|
child = xmpp_stanza_get_next(child);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug("Handle bookmark for %s", jid);
|
log_debug("Handle bookmark for %s", barejid);
|
||||||
|
|
||||||
char *nick = NULL;
|
char *nick = NULL;
|
||||||
xmpp_stanza_t *nick_st = xmpp_stanza_get_child_by_name(child, "nick");
|
xmpp_stanza_t *nick_st = xmpp_stanza_get_child_by_name(child, "nick");
|
||||||
@ -285,13 +285,13 @@ _bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
|
|||||||
autojoin_val = TRUE;
|
autojoin_val = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
autocomplete_add(bookmark_ac, jid);
|
autocomplete_add(bookmark_ac, barejid);
|
||||||
Bookmark *bookmark = malloc(sizeof(Bookmark));
|
Bookmark *bookmark = malloc(sizeof(Bookmark));
|
||||||
bookmark->jid = strdup(jid);
|
bookmark->barejid = strdup(barejid);
|
||||||
bookmark->nick = nick;
|
bookmark->nick = nick;
|
||||||
bookmark->password = password;
|
bookmark->password = password;
|
||||||
bookmark->autojoin = autojoin_val;
|
bookmark->autojoin = autojoin_val;
|
||||||
g_hash_table_insert(bookmarks, strdup(jid), bookmark);
|
g_hash_table_insert(bookmarks, strdup(barejid), bookmark);
|
||||||
|
|
||||||
if (autojoin_val) {
|
if (autojoin_val) {
|
||||||
Jid *room_jid;
|
Jid *room_jid;
|
||||||
@ -302,11 +302,11 @@ _bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
|
|||||||
nick = account->muc_nick;
|
nick = account->muc_nick;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug("Autojoin %s with nick=%s", jid, nick);
|
log_debug("Autojoin %s with nick=%s", barejid, nick);
|
||||||
room_jid = jid_create_from_bare_and_resource(jid, nick);
|
room_jid = jid_create_from_bare_and_resource(barejid, nick);
|
||||||
if (!muc_active(room_jid->barejid)) {
|
if (!muc_active(room_jid->barejid)) {
|
||||||
presence_join_room(jid, nick, password);
|
presence_join_room(barejid, nick, password);
|
||||||
muc_join(jid, nick, password, TRUE);
|
muc_join(barejid, nick, password, TRUE);
|
||||||
}
|
}
|
||||||
jid_destroy(room_jid);
|
jid_destroy(room_jid);
|
||||||
account_free(account);
|
account_free(account);
|
||||||
@ -325,7 +325,7 @@ _bookmark_destroy(Bookmark *bookmark)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(bookmark->jid);
|
free(bookmark->barejid);
|
||||||
free(bookmark->nick);
|
free(bookmark->nick);
|
||||||
free(bookmark->password);
|
free(bookmark->password);
|
||||||
free(bookmark);
|
free(bookmark);
|
||||||
@ -354,9 +354,9 @@ _send_bookmarks(void)
|
|||||||
Bookmark *bookmark = curr->data;
|
Bookmark *bookmark = curr->data;
|
||||||
xmpp_stanza_t *conference = xmpp_stanza_new(ctx);
|
xmpp_stanza_t *conference = xmpp_stanza_new(ctx);
|
||||||
xmpp_stanza_set_name(conference, STANZA_NAME_CONFERENCE);
|
xmpp_stanza_set_name(conference, STANZA_NAME_CONFERENCE);
|
||||||
xmpp_stanza_set_attribute(conference, STANZA_ATTR_JID, bookmark->jid);
|
xmpp_stanza_set_attribute(conference, STANZA_ATTR_JID, bookmark->barejid);
|
||||||
|
|
||||||
Jid *jidp = jid_create(bookmark->jid);
|
Jid *jidp = jid_create(bookmark->barejid);
|
||||||
if (jidp->localpart) {
|
if (jidp->localpart) {
|
||||||
xmpp_stanza_set_attribute(conference, STANZA_ATTR_NAME, jidp->localpart);
|
xmpp_stanza_set_attribute(conference, STANZA_ATTR_NAME, jidp->localpart);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ typedef enum {
|
|||||||
} jabber_invite_t;
|
} jabber_invite_t;
|
||||||
|
|
||||||
typedef struct bookmark_t {
|
typedef struct bookmark_t {
|
||||||
char *jid;
|
char *barejid;
|
||||||
char *nick;
|
char *nick;
|
||||||
char *password;
|
char *password;
|
||||||
gboolean autojoin;
|
gboolean autojoin;
|
||||||
|
@ -62,7 +62,7 @@ void cmd_bookmark_shows_usage_when_no_args(void **state)
|
|||||||
|
|
||||||
static void _free_bookmark(Bookmark *bookmark)
|
static void _free_bookmark(Bookmark *bookmark)
|
||||||
{
|
{
|
||||||
free(bookmark->jid);
|
free(bookmark->barejid);
|
||||||
free(bookmark->nick);
|
free(bookmark->nick);
|
||||||
free(bookmark);
|
free(bookmark);
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ static void _free_bookmark(Bookmark *bookmark)
|
|||||||
static gboolean
|
static gboolean
|
||||||
_cmp_bookmark(Bookmark *bm1, Bookmark *bm2)
|
_cmp_bookmark(Bookmark *bm1, Bookmark *bm2)
|
||||||
{
|
{
|
||||||
if (strcmp(bm1->jid, bm2->jid) != 0) {
|
if (strcmp(bm1->barejid, bm2->barejid) != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (strcmp(bm1->nick, bm2->nick) != 0) {
|
if (strcmp(bm1->nick, bm2->nick) != 0) {
|
||||||
@ -91,23 +91,23 @@ void cmd_bookmark_list_shows_bookmarks(void **state)
|
|||||||
window.type = WIN_CONSOLE;
|
window.type = WIN_CONSOLE;
|
||||||
|
|
||||||
Bookmark *bm1 = malloc(sizeof(Bookmark));
|
Bookmark *bm1 = malloc(sizeof(Bookmark));
|
||||||
bm1->jid = strdup("room1@conf.org");
|
bm1->barejid = strdup("room1@conf.org");
|
||||||
bm1->nick = strdup("bob");
|
bm1->nick = strdup("bob");
|
||||||
bm1->autojoin = FALSE;
|
bm1->autojoin = FALSE;
|
||||||
Bookmark *bm2 = malloc(sizeof(Bookmark));
|
Bookmark *bm2 = malloc(sizeof(Bookmark));
|
||||||
bm2->jid = strdup("room2@conf.org");
|
bm2->barejid = strdup("room2@conf.org");
|
||||||
bm2->nick = strdup("steve");
|
bm2->nick = strdup("steve");
|
||||||
bm2->autojoin = TRUE;
|
bm2->autojoin = TRUE;
|
||||||
Bookmark *bm3 = malloc(sizeof(Bookmark));
|
Bookmark *bm3 = malloc(sizeof(Bookmark));
|
||||||
bm3->jid = strdup("room3@conf.org");
|
bm3->barejid = strdup("room3@conf.org");
|
||||||
bm3->nick = strdup("dave");
|
bm3->nick = strdup("dave");
|
||||||
bm3->autojoin = TRUE;
|
bm3->autojoin = TRUE;
|
||||||
Bookmark *bm4 = malloc(sizeof(Bookmark));
|
Bookmark *bm4 = malloc(sizeof(Bookmark));
|
||||||
bm4->jid = strdup("room4@conf.org");
|
bm4->barejid = strdup("room4@conf.org");
|
||||||
bm4->nick = strdup("james");
|
bm4->nick = strdup("james");
|
||||||
bm4->autojoin = FALSE;
|
bm4->autojoin = FALSE;
|
||||||
Bookmark *bm5 = malloc(sizeof(Bookmark));
|
Bookmark *bm5 = malloc(sizeof(Bookmark));
|
||||||
bm5->jid = strdup("room5@conf.org");
|
bm5->barejid = strdup("room5@conf.org");
|
||||||
bm5->nick = strdup("mike");
|
bm5->nick = strdup("mike");
|
||||||
bm5->autojoin = FALSE;
|
bm5->autojoin = FALSE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user