Add sv_ev_bookmark_autojoin
This commit is contained in:
@@ -1079,3 +1079,25 @@ sv_ev_lastactivity_response(const char *const from, const int seconds, const cha
|
||||
g_free(date_fmt);
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
|
||||
void
|
||||
sv_ev_bookmark_autojoin(Bookmark *bookmark)
|
||||
{
|
||||
char *nick = NULL;
|
||||
if (bookmark->nick) {
|
||||
nick = strdup(bookmark->nick);
|
||||
} else {
|
||||
char *account_name = session_get_account_name();
|
||||
ProfAccount *account = accounts_get_account(account_name);
|
||||
nick = strdup(account->muc_nick);
|
||||
account_free(account);
|
||||
}
|
||||
|
||||
log_debug("Autojoin %s with nick=%s", bookmark->barejid, nick);
|
||||
if (!muc_active(bookmark->barejid)) {
|
||||
presence_join_room(bookmark->barejid, nick, bookmark->password);
|
||||
muc_join(bookmark->barejid, nick, bookmark->password, TRUE);
|
||||
}
|
||||
|
||||
free(nick);
|
||||
}
|
||||
|
||||
@@ -87,5 +87,6 @@ void sv_ev_roster_update(const char *const barejid, const char *const name,
|
||||
void sv_ev_roster_received(void);
|
||||
int sv_ev_certfail(const char *const errormsg, TLSCertificate *cert);
|
||||
void sv_ev_lastactivity_response(const char *const from, const int seconds, const char *const msg);
|
||||
void sv_ev_bookmark_autojoin(Bookmark *bookmark);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user