mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Rename jabber_ functions
This commit is contained in:
parent
3bb1f12410
commit
88f423afea
@ -150,7 +150,7 @@ cmd_execute_default(ProfWin *window, const char *inp)
|
|||||||
}
|
}
|
||||||
case WIN_XML:
|
case WIN_XML:
|
||||||
{
|
{
|
||||||
jabber_send_stanza(inp);
|
session_send_stanza(inp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -232,11 +232,11 @@ cmd_tls_trust(ProfWin *window, const char *const command, gchar **args)
|
|||||||
cons_show("You are not currently connected.");
|
cons_show("You are not currently connected.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (!jabber_conn_is_secured()) {
|
if (!session_conn_is_secured()) {
|
||||||
cons_show("No TLS connection established");
|
cons_show("No TLS connection established");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
TLSCertificate *cert = jabber_get_tls_peer_cert();
|
TLSCertificate *cert = session_get_tls_peer_cert();
|
||||||
if (!cert) {
|
if (!cert) {
|
||||||
cons_show("Error getting TLS certificate.");
|
cons_show("Error getting TLS certificate.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -330,11 +330,11 @@ cmd_tls_cert(ProfWin *window, const char *const command, gchar **args)
|
|||||||
cons_show("You are not currently connected.");
|
cons_show("You are not currently connected.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (!jabber_conn_is_secured()) {
|
if (!session_conn_is_secured()) {
|
||||||
cons_show("No TLS connection established");
|
cons_show("No TLS connection established");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
TLSCertificate *cert = jabber_get_tls_peer_cert();
|
TLSCertificate *cert = session_get_tls_peer_cert();
|
||||||
if (!cert) {
|
if (!cert) {
|
||||||
cons_show("Error getting TLS certificate.");
|
cons_show("Error getting TLS certificate.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -807,7 +807,7 @@ _account_set_theme(char *account_name, char *theme)
|
|||||||
|
|
||||||
accounts_set_theme(account_name, theme);
|
accounts_set_theme(account_name, theme);
|
||||||
if (connection_get_status() == JABBER_CONNECTED) {
|
if (connection_get_status() == JABBER_CONNECTED) {
|
||||||
ProfAccount *account = accounts_get_account(jabber_get_account_name());
|
ProfAccount *account = accounts_get_account(session_get_account_name());
|
||||||
if (account) {
|
if (account) {
|
||||||
if (g_strcmp0(account->name, account_name) == 0) {
|
if (g_strcmp0(account->name, account_name) == 0) {
|
||||||
theme_load(theme);
|
theme_load(theme);
|
||||||
@ -880,7 +880,7 @@ _account_set_presence_priority(char *account_name, char *presence, char *priorit
|
|||||||
|
|
||||||
jabber_conn_status_t conn_status = connection_get_status();
|
jabber_conn_status_t conn_status = connection_get_status();
|
||||||
if (conn_status == JABBER_CONNECTED) {
|
if (conn_status == JABBER_CONNECTED) {
|
||||||
char *connected_account = jabber_get_account_name();
|
char *connected_account = session_get_account_name();
|
||||||
resource_presence_t last_presence = accounts_get_last_presence(connected_account);
|
resource_presence_t last_presence = accounts_get_last_presence(connected_account);
|
||||||
if (presence_type == last_presence) {
|
if (presence_type == last_presence) {
|
||||||
char *message = connection_get_presence_msg();
|
char *message = connection_get_presence_msg();
|
||||||
@ -1004,7 +1004,7 @@ cmd_account(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfAccount *account = accounts_get_account(jabber_get_account_name());
|
ProfAccount *account = accounts_get_account(session_get_account_name());
|
||||||
cons_show_account(account);
|
cons_show_account(account);
|
||||||
account_free(account);
|
account_free(account);
|
||||||
|
|
||||||
@ -2991,7 +2991,7 @@ cmd_blocked(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!jabber_service_supports(XMPP_FEATURE_BLOCKING)) {
|
if (!session_service_supports(XMPP_FEATURE_BLOCKING)) {
|
||||||
cons_show("Blocking not supported by server.");
|
cons_show("Blocking not supported by server.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -3419,7 +3419,7 @@ cmd_software(ProfWin *window, const char *const command, gchar **args)
|
|||||||
break;
|
break;
|
||||||
case WIN_CONSOLE:
|
case WIN_CONSOLE:
|
||||||
if (args[0]) {
|
if (args[0]) {
|
||||||
Jid *myJid = jid_create(jabber_get_fulljid());
|
Jid *myJid = jid_create(session_get_fulljid());
|
||||||
Jid *jid = jid_create(args[0]);
|
Jid *jid = jid_create(args[0]);
|
||||||
|
|
||||||
if (jid == NULL || jid->fulljid == NULL) {
|
if (jid == NULL || jid->fulljid == NULL) {
|
||||||
@ -3461,13 +3461,13 @@ cmd_join(ProfWin *window, const char *const command, gchar **args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args[0] == NULL) {
|
if (args[0] == NULL) {
|
||||||
char *account_name = jabber_get_account_name();
|
char *account_name = session_get_account_name();
|
||||||
ProfAccount *account = accounts_get_account(account_name);
|
ProfAccount *account = accounts_get_account(account_name);
|
||||||
|
|
||||||
GString *room_str = g_string_new("");
|
GString *room_str = g_string_new("");
|
||||||
char *uuid = jabber_create_uuid();
|
char *uuid = session_create_uuid();
|
||||||
g_string_append_printf(room_str, "private-chat-%s@%s", uuid, account->muc_service);
|
g_string_append_printf(room_str, "private-chat-%s@%s", uuid, account->muc_service);
|
||||||
jabber_free_uuid(uuid);
|
session_free_uuid(uuid);
|
||||||
|
|
||||||
presence_join_room(room_str->str, account->muc_nick, NULL);
|
presence_join_room(room_str->str, account->muc_nick, NULL);
|
||||||
muc_join(room_str->str, account->muc_nick, NULL, FALSE);
|
muc_join(room_str->str, account->muc_nick, NULL, FALSE);
|
||||||
@ -3489,7 +3489,7 @@ cmd_join(ProfWin *window, const char *const command, gchar **args)
|
|||||||
char *nick = NULL;
|
char *nick = NULL;
|
||||||
char *passwd = NULL;
|
char *passwd = NULL;
|
||||||
GString *room_str = g_string_new("");
|
GString *room_str = g_string_new("");
|
||||||
char *account_name = jabber_get_account_name();
|
char *account_name = session_get_account_name();
|
||||||
ProfAccount *account = accounts_get_account(account_name);
|
ProfAccount *account = accounts_get_account(account_name);
|
||||||
|
|
||||||
// full room jid supplied (room@server)
|
// full room jid supplied (room@server)
|
||||||
@ -4346,7 +4346,7 @@ cmd_rooms(ProfWin *window, const char *const command, gchar **args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args[0] == NULL) {
|
if (args[0] == NULL) {
|
||||||
ProfAccount *account = accounts_get_account(jabber_get_account_name());
|
ProfAccount *account = accounts_get_account(session_get_account_name());
|
||||||
iq_room_list_request(account->muc_service);
|
iq_room_list_request(account->muc_service);
|
||||||
account_free(account);
|
account_free(account);
|
||||||
} else {
|
} else {
|
||||||
@ -4481,7 +4481,7 @@ cmd_disco(ProfWin *window, const char *const command, gchar **args)
|
|||||||
if (args[1]) {
|
if (args[1]) {
|
||||||
jid = g_string_append(jid, args[1]);
|
jid = g_string_append(jid, args[1]);
|
||||||
} else {
|
} else {
|
||||||
Jid *jidp = jid_create(jabber_get_fulljid());
|
Jid *jidp = jid_create(session_get_fulljid());
|
||||||
jid = g_string_append(jid, jidp->domainpart);
|
jid = g_string_append(jid, jidp->domainpart);
|
||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
}
|
}
|
||||||
@ -4564,7 +4564,7 @@ cmd_lastactivity(ProfWin *window, const char *const command, gchar **args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args[0] == NULL) {
|
if (args[0] == NULL) {
|
||||||
Jid *jidp = jid_create(jabber_get_fulljid());
|
Jid *jidp = jid_create(session_get_fulljid());
|
||||||
GString *jid = g_string_new(jidp->domainpart);
|
GString *jid = g_string_new(jidp->domainpart);
|
||||||
|
|
||||||
iq_last_activity_request(jid->str);
|
iq_last_activity_request(jid->str);
|
||||||
@ -5761,8 +5761,8 @@ cmd_priority(ProfWin *window, const char *const command, gchar **args)
|
|||||||
char *err_msg = NULL;
|
char *err_msg = NULL;
|
||||||
gboolean res = strtoi_range(value, &intval, -128, 127, &err_msg);
|
gboolean res = strtoi_range(value, &intval, -128, 127, &err_msg);
|
||||||
if (res) {
|
if (res) {
|
||||||
accounts_set_priority_all(jabber_get_account_name(), intval);
|
accounts_set_priority_all(session_get_account_name(), intval);
|
||||||
resource_presence_t last_presence = accounts_get_last_presence(jabber_get_account_name());
|
resource_presence_t last_presence = accounts_get_last_presence(session_get_account_name());
|
||||||
cl_ev_presence_send(last_presence, connection_get_presence_msg(), 0);
|
cl_ev_presence_send(last_presence, connection_get_presence_msg(), 0);
|
||||||
cons_show("Priority set to %d.", intval);
|
cons_show("Priority set to %d.", intval);
|
||||||
} else {
|
} else {
|
||||||
@ -6235,7 +6235,7 @@ cmd_pgp(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfAccount *account = accounts_get_account(jabber_get_account_name());
|
ProfAccount *account = accounts_get_account(session_get_account_name());
|
||||||
char *err_str = NULL;
|
char *err_str = NULL;
|
||||||
if (!p_gpg_valid_key(account->pgp_keyid, &err_str)) {
|
if (!p_gpg_valid_key(account->pgp_keyid, &err_str)) {
|
||||||
ui_current_print_formatted_line('!', 0, "Invalid PGP key ID %s: %s, cannot start PGP encryption.", account->pgp_keyid, err_str);
|
ui_current_print_formatted_line('!', 0, "Invalid PGP key ID %s: %s, cannot start PGP encryption.", account->pgp_keyid, err_str);
|
||||||
@ -6384,7 +6384,7 @@ cmd_otr_policy(ProfWin *window, const char *const command, gchar **args)
|
|||||||
if (contact_jid == NULL) {
|
if (contact_jid == NULL) {
|
||||||
contact_jid = contact;
|
contact_jid = contact;
|
||||||
}
|
}
|
||||||
accounts_add_otr_policy(jabber_get_account_name(), contact_jid, choice);
|
accounts_add_otr_policy(session_get_account_name(), contact_jid, choice);
|
||||||
cons_show("OTR policy for %s set to: %s", contact_jid, choice);
|
cons_show("OTR policy for %s set to: %s", contact_jid, choice);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#else
|
#else
|
||||||
@ -6402,7 +6402,7 @@ cmd_otr_gen(ProfWin *window, const char *const command, gchar **args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProfAccount *account = accounts_get_account(jabber_get_account_name());
|
ProfAccount *account = accounts_get_account(session_get_account_name());
|
||||||
otr_keygen(account);
|
otr_keygen(account);
|
||||||
account_free(account);
|
account_free(account);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -159,7 +159,7 @@ scripts_exec(const char *const script)
|
|||||||
while ((read = getline(&line, &len, scriptfile)) != -1) {
|
while ((read = getline(&line, &len, scriptfile)) != -1) {
|
||||||
ProfWin *win = wins_get_current();
|
ProfWin *win = wins_get_current();
|
||||||
cmd_process_input(win, line);
|
cmd_process_input(win, line);
|
||||||
jabber_process_events(10);
|
session_process_events(10);
|
||||||
ui_update();
|
ui_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ jabber_conn_status_t
|
|||||||
cl_ev_connect_jid(const char *const jid, const char *const passwd, const char *const altdomain, const int port, const char *const tls_policy)
|
cl_ev_connect_jid(const char *const jid, const char *const passwd, const char *const altdomain, const int port, const char *const tls_policy)
|
||||||
{
|
{
|
||||||
cons_show("Connecting as %s", jid);
|
cons_show("Connecting as %s", jid);
|
||||||
return jabber_connect_with_details(jid, passwd, altdomain, port, tls_policy);
|
return session_connect_with_details(jid, passwd, altdomain, port, tls_policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
jabber_conn_status_t
|
jabber_conn_status_t
|
||||||
@ -65,18 +65,18 @@ cl_ev_connect_account(ProfAccount *account)
|
|||||||
cons_show("Connecting with account %s as %s", account->name, jid);
|
cons_show("Connecting with account %s as %s", account->name, jid);
|
||||||
free(jid);
|
free(jid);
|
||||||
|
|
||||||
return jabber_connect_with_account(account);
|
return session_connect_with_account(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cl_ev_disconnect(void)
|
cl_ev_disconnect(void)
|
||||||
{
|
{
|
||||||
const char *jid = jabber_get_fulljid();
|
const char *jid = session_get_fulljid();
|
||||||
cons_show("%s logged out successfully.", jid);
|
cons_show("%s logged out successfully.", jid);
|
||||||
|
|
||||||
ui_disconnected();
|
ui_disconnected();
|
||||||
ui_close_all_wins();
|
ui_close_all_wins();
|
||||||
jabber_disconnect();
|
session_disconnect();
|
||||||
roster_destroy();
|
roster_destroy();
|
||||||
muc_invites_clear();
|
muc_invites_clear();
|
||||||
chat_sessions_clear();
|
chat_sessions_clear();
|
||||||
@ -92,7 +92,7 @@ cl_ev_presence_send(const resource_presence_t presence_type, const char *const m
|
|||||||
char *signed_status = NULL;
|
char *signed_status = NULL;
|
||||||
|
|
||||||
#ifdef HAVE_LIBGPGME
|
#ifdef HAVE_LIBGPGME
|
||||||
char *account_name = jabber_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 (account->pgp_keyid) {
|
if (account->pgp_keyid) {
|
||||||
signed_status = p_gpg_sign(msg, account->pgp_keyid);
|
signed_status = p_gpg_sign(msg, account->pgp_keyid);
|
||||||
|
@ -105,7 +105,7 @@ sv_ev_roster_received(void)
|
|||||||
ui_show_roster();
|
ui_show_roster();
|
||||||
}
|
}
|
||||||
|
|
||||||
char *account_name = jabber_get_account_name();
|
char *account_name = session_get_account_name();
|
||||||
|
|
||||||
#ifdef HAVE_LIBGPGME
|
#ifdef HAVE_LIBGPGME
|
||||||
// check pgp key valid if specified
|
// check pgp key valid if specified
|
||||||
@ -148,7 +148,7 @@ sv_ev_roster_received(void)
|
|||||||
cl_ev_presence_send(conn_presence, NULL, 0);
|
cl_ev_presence_send(conn_presence, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *fulljid = jabber_get_fulljid();
|
const char *fulljid = session_get_fulljid();
|
||||||
plugins_on_connect(account_name, fulljid);
|
plugins_on_connect(account_name, fulljid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ void
|
|||||||
sv_ev_room_message(const char *const room_jid, const char *const nick, const char *const message)
|
sv_ev_room_message(const char *const room_jid, const char *const nick, const char *const message)
|
||||||
{
|
{
|
||||||
if (prefs_get_boolean(PREF_GRLOG)) {
|
if (prefs_get_boolean(PREF_GRLOG)) {
|
||||||
Jid *jid = jid_create(jabber_get_fulljid());
|
Jid *jid = jid_create(session_get_fulljid());
|
||||||
groupchat_log_chat(jid->barejid, room_jid, nick, message);
|
groupchat_log_chat(jid->barejid, room_jid, nick, message);
|
||||||
jid_destroy(jid);
|
jid_destroy(jid);
|
||||||
}
|
}
|
||||||
|
12
src/log.c
12
src/log.c
@ -265,7 +265,7 @@ void
|
|||||||
chat_log_msg_out(const char *const barejid, const char *const msg)
|
chat_log_msg_out(const char *const barejid, const char *const msg)
|
||||||
{
|
{
|
||||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||||
const char *jid = jabber_get_fulljid();
|
const char *jid = session_get_fulljid();
|
||||||
Jid *jidp = jid_create(jid);
|
Jid *jidp = jid_create(jid);
|
||||||
_chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL);
|
_chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL);
|
||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
@ -276,7 +276,7 @@ void
|
|||||||
chat_log_otr_msg_out(const char *const barejid, const char *const msg)
|
chat_log_otr_msg_out(const char *const barejid, const char *const msg)
|
||||||
{
|
{
|
||||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||||
const char *jid = jabber_get_fulljid();
|
const char *jid = session_get_fulljid();
|
||||||
Jid *jidp = jid_create(jid);
|
Jid *jidp = jid_create(jid);
|
||||||
char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
|
char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
|
||||||
if (strcmp(pref_otr_log, "on") == 0) {
|
if (strcmp(pref_otr_log, "on") == 0) {
|
||||||
@ -293,7 +293,7 @@ void
|
|||||||
chat_log_pgp_msg_out(const char *const barejid, const char *const msg)
|
chat_log_pgp_msg_out(const char *const barejid, const char *const msg)
|
||||||
{
|
{
|
||||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||||
const char *jid = jabber_get_fulljid();
|
const char *jid = session_get_fulljid();
|
||||||
Jid *jidp = jid_create(jid);
|
Jid *jidp = jid_create(jid);
|
||||||
char *pref_pgp_log = prefs_get_string(PREF_PGP_LOG);
|
char *pref_pgp_log = prefs_get_string(PREF_PGP_LOG);
|
||||||
if (strcmp(pref_pgp_log, "on") == 0) {
|
if (strcmp(pref_pgp_log, "on") == 0) {
|
||||||
@ -310,7 +310,7 @@ void
|
|||||||
chat_log_otr_msg_in(const char *const barejid, const char *const msg, gboolean was_decrypted, GDateTime *timestamp)
|
chat_log_otr_msg_in(const char *const barejid, const char *const msg, gboolean was_decrypted, GDateTime *timestamp)
|
||||||
{
|
{
|
||||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||||
const char *jid = jabber_get_fulljid();
|
const char *jid = session_get_fulljid();
|
||||||
Jid *jidp = jid_create(jid);
|
Jid *jidp = jid_create(jid);
|
||||||
char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
|
char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
|
||||||
if (!was_decrypted || (strcmp(pref_otr_log, "on") == 0)) {
|
if (!was_decrypted || (strcmp(pref_otr_log, "on") == 0)) {
|
||||||
@ -327,7 +327,7 @@ void
|
|||||||
chat_log_pgp_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp)
|
chat_log_pgp_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp)
|
||||||
{
|
{
|
||||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||||
const char *jid = jabber_get_fulljid();
|
const char *jid = session_get_fulljid();
|
||||||
Jid *jidp = jid_create(jid);
|
Jid *jidp = jid_create(jid);
|
||||||
char *pref_pgp_log = prefs_get_string(PREF_PGP_LOG);
|
char *pref_pgp_log = prefs_get_string(PREF_PGP_LOG);
|
||||||
if (strcmp(pref_pgp_log, "on") == 0) {
|
if (strcmp(pref_pgp_log, "on") == 0) {
|
||||||
@ -344,7 +344,7 @@ void
|
|||||||
chat_log_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp)
|
chat_log_msg_in(const char *const barejid, const char *const msg, GDateTime *timestamp)
|
||||||
{
|
{
|
||||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||||
const char *jid = jabber_get_fulljid();
|
const char *jid = session_get_fulljid();
|
||||||
Jid *jidp = jid_create(jid);
|
Jid *jidp = jid_create(jid);
|
||||||
_chat_log_chat(jidp->barejid, barejid, msg, PROF_IN_LOG, timestamp);
|
_chat_log_chat(jidp->barejid, barejid, msg, PROF_IN_LOG, timestamp);
|
||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
|
@ -673,7 +673,7 @@ otr_get_their_fingerprint(const char *const recipient)
|
|||||||
prof_otrpolicy_t
|
prof_otrpolicy_t
|
||||||
otr_get_policy(const char *const recipient)
|
otr_get_policy(const char *const recipient)
|
||||||
{
|
{
|
||||||
char *account_name = jabber_get_account_name();
|
char *account_name = session_get_account_name();
|
||||||
ProfAccount *account = accounts_get_account(account_name);
|
ProfAccount *account = accounts_get_account(account_name);
|
||||||
// check contact specific setting
|
// check contact specific setting
|
||||||
if (g_list_find_custom(account->otr_manual, recipient, (GCompareFunc)g_strcmp0)) {
|
if (g_list_find_custom(account->otr_manual, recipient, (GCompareFunc)g_strcmp0)) {
|
||||||
|
@ -381,7 +381,7 @@ api_win_show_themed(const char *tag, const char *const group, const char *const
|
|||||||
int
|
int
|
||||||
api_send_stanza(const char *const stanza)
|
api_send_stanza(const char *const stanza)
|
||||||
{
|
{
|
||||||
return jabber_send_stanza(stanza);
|
return session_send_stanza(stanza);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -441,7 +441,7 @@ api_disco_add_feature(char *feature)
|
|||||||
|
|
||||||
// resend presence to update server's disco info data for this client
|
// resend presence to update server's disco info data for this client
|
||||||
if (connection_get_status() == JABBER_CONNECTED) {
|
if (connection_get_status() == JABBER_CONNECTED) {
|
||||||
resource_presence_t last_presence = accounts_get_last_presence(jabber_get_account_name());
|
resource_presence_t last_presence = accounts_get_last_presence(session_get_account_name());
|
||||||
cl_ev_presence_send(last_presence, connection_get_presence_msg(), 0);
|
cl_ev_presence_send(last_presence, connection_get_presence_msg(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,8 +158,8 @@ plugins_load(const char *const name)
|
|||||||
if (plugin) {
|
if (plugin) {
|
||||||
plugins = g_slist_append(plugins, plugin);
|
plugins = g_slist_append(plugins, plugin);
|
||||||
if (connection_get_status() == JABBER_CONNECTED) {
|
if (connection_get_status() == JABBER_CONNECTED) {
|
||||||
const char *account_name = jabber_get_account_name();
|
const char *account_name = session_get_account_name();
|
||||||
const char *fulljid = jabber_get_fulljid();
|
const char *fulljid = session_get_fulljid();
|
||||||
plugin->init_func(plugin, PACKAGE_VERSION, PACKAGE_STATUS, account_name, fulljid);
|
plugin->init_func(plugin, PACKAGE_VERSION, PACKAGE_STATUS, account_name, fulljid);
|
||||||
} else {
|
} else {
|
||||||
plugin->init_func(plugin, PACKAGE_VERSION, PACKAGE_STATUS, NULL, NULL);
|
plugin->init_func(plugin, PACKAGE_VERSION, PACKAGE_STATUS, NULL, NULL);
|
||||||
|
@ -130,7 +130,7 @@ prof_run(char *log_level, char *account_name)
|
|||||||
#endif
|
#endif
|
||||||
plugins_run_timed();
|
plugins_run_timed();
|
||||||
notify_remind();
|
notify_remind();
|
||||||
jabber_process_events(10);
|
session_process_events(10);
|
||||||
iq_autoping_check();
|
iq_autoping_check();
|
||||||
ui_update();
|
ui_update();
|
||||||
#ifdef HAVE_GTK
|
#ifdef HAVE_GTK
|
||||||
@ -209,7 +209,7 @@ _check_autoaway(void)
|
|||||||
int away_time_ms = away_time * 60000;
|
int away_time_ms = away_time * 60000;
|
||||||
int xa_time_ms = xa_time * 60000;
|
int xa_time_ms = xa_time * 60000;
|
||||||
|
|
||||||
char *account = jabber_get_account_name();
|
char *account = session_get_account_name();
|
||||||
resource_presence_t curr_presence = accounts_get_last_presence(account);
|
resource_presence_t curr_presence = accounts_get_last_presence(account);
|
||||||
char *curr_status = accounts_get_last_status(account);
|
char *curr_status = accounts_get_last_status(account);
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ _init(char *log_level)
|
|||||||
theme_init(theme);
|
theme_init(theme);
|
||||||
prefs_free_string(theme);
|
prefs_free_string(theme);
|
||||||
ui_init();
|
ui_init();
|
||||||
jabber_init();
|
session_init();
|
||||||
cmd_init();
|
cmd_init();
|
||||||
log_info("Initialising contact list");
|
log_info("Initialising contact list");
|
||||||
muc_init();
|
muc_init();
|
||||||
@ -387,7 +387,7 @@ _shutdown(void)
|
|||||||
#ifdef HAVE_GTK
|
#ifdef HAVE_GTK
|
||||||
tray_shutdown();
|
tray_shutdown();
|
||||||
#endif
|
#endif
|
||||||
jabber_shutdown();
|
session_shutdown();
|
||||||
plugins_on_shutdown();
|
plugins_on_shutdown();
|
||||||
muc_close();
|
muc_close();
|
||||||
caps_close();
|
caps_close();
|
||||||
|
@ -388,7 +388,7 @@ static void
|
|||||||
_chatwin_history(ProfChatWin *chatwin, const char *const contact)
|
_chatwin_history(ProfChatWin *chatwin, const char *const contact)
|
||||||
{
|
{
|
||||||
if (!chatwin->history_shown) {
|
if (!chatwin->history_shown) {
|
||||||
Jid *jid = jid_create(jabber_get_fulljid());
|
Jid *jid = jid_create(session_get_fulljid());
|
||||||
GSList *history = chat_log_get_previous(jid->barejid, contact);
|
GSList *history = chat_log_get_previous(jid->barejid, contact);
|
||||||
jid_destroy(jid);
|
jid_destroy(jid);
|
||||||
GSList *curr = history;
|
GSList *curr = history;
|
||||||
|
@ -846,7 +846,7 @@ cons_show_account_list(gchar **accounts)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
if ((connection_get_status() == JABBER_CONNECTED) &&
|
if ((connection_get_status() == JABBER_CONNECTED) &&
|
||||||
(g_strcmp0(jabber_get_account_name(), accounts[i]) == 0)) {
|
(g_strcmp0(session_get_account_name(), accounts[i]) == 0)) {
|
||||||
resource_presence_t presence = accounts_get_last_presence(accounts[i]);
|
resource_presence_t presence = accounts_get_last_presence(accounts[i]);
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs(string_from_resource_presence(presence));
|
theme_item_t presence_colour = theme_main_presence_attrs(string_from_resource_presence(presence));
|
||||||
win_vprint(console, '-', 0, NULL, 0, presence_colour, "", "%s", accounts[i]);
|
win_vprint(console, '-', 0, NULL, 0, presence_colour, "", "%s", accounts[i]);
|
||||||
@ -962,8 +962,8 @@ cons_show_account(ProfAccount *account)
|
|||||||
account->priority_xa, account->priority_dnd);
|
account->priority_xa, account->priority_dnd);
|
||||||
|
|
||||||
if ((connection_get_status() == JABBER_CONNECTED) &&
|
if ((connection_get_status() == JABBER_CONNECTED) &&
|
||||||
(g_strcmp0(jabber_get_account_name(), account->name) == 0)) {
|
(g_strcmp0(session_get_account_name(), account->name) == 0)) {
|
||||||
GList *resources = jabber_get_available_resources();
|
GList *resources = session_get_available_resources();
|
||||||
GList *ordered_resources = NULL;
|
GList *ordered_resources = NULL;
|
||||||
|
|
||||||
GList *curr = resources;
|
GList *curr = resources;
|
||||||
|
@ -394,7 +394,7 @@ ui_update_presence(const resource_presence_t resource_presence,
|
|||||||
{
|
{
|
||||||
contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence);
|
contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence);
|
||||||
title_bar_set_presence(contact_presence);
|
title_bar_set_presence(contact_presence);
|
||||||
gint priority = accounts_get_priority_for_presence_type(jabber_get_account_name(), resource_presence);
|
gint priority = accounts_get_priority_for_presence_type(session_get_account_name(), resource_presence);
|
||||||
if (message) {
|
if (message) {
|
||||||
cons_show("Status set to %s (priority %d), \"%s\".", show, priority, message);
|
cons_show("Status set to %s (priority %d), \"%s\".", show, priority, message);
|
||||||
} else {
|
} else {
|
||||||
@ -1107,7 +1107,7 @@ _ui_draw_term_title(void)
|
|||||||
jabber_conn_status_t status = connection_get_status();
|
jabber_conn_status_t status = connection_get_status();
|
||||||
|
|
||||||
if (status == JABBER_CONNECTED) {
|
if (status == JABBER_CONNECTED) {
|
||||||
const char * const jid = jabber_get_fulljid();
|
const char * const jid = session_get_fulljid();
|
||||||
gint unread = wins_get_total_unread();
|
gint unread = wins_get_total_unread();
|
||||||
|
|
||||||
if (unread != 0) {
|
if (unread != 0) {
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "xmpp/session.h"
|
#include "xmpp/session.h"
|
||||||
|
#include "xmpp/connection.h"
|
||||||
#include "xmpp/stanza.h"
|
#include "xmpp/stanza.h"
|
||||||
#include "xmpp/iq.h"
|
#include "xmpp/iq.h"
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "muc.h"
|
#include "muc.h"
|
||||||
#include "event/server_events.h"
|
#include "event/server_events.h"
|
||||||
#include "xmpp/session.h"
|
#include "xmpp/connection.h"
|
||||||
#include "xmpp/iq.h"
|
#include "xmpp/iq.h"
|
||||||
#include "xmpp/stanza.h"
|
#include "xmpp/stanza.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
@ -177,7 +177,7 @@ bookmark_join(const char *jid)
|
|||||||
if (found == NULL) {
|
if (found == NULL) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
char *account_name = jabber_get_account_name();
|
char *account_name = session_get_account_name();
|
||||||
ProfAccount *account = accounts_get_account(account_name);
|
ProfAccount *account = accounts_get_account(account_name);
|
||||||
Bookmark *item = found->data;
|
Bookmark *item = found->data;
|
||||||
if (!muc_active(item->jid)) {
|
if (!muc_active(item->jid)) {
|
||||||
@ -276,7 +276,7 @@ _bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
|
|||||||
if (bookmark_ac == NULL) {
|
if (bookmark_ac == NULL) {
|
||||||
bookmark_ac = autocomplete_new();
|
bookmark_ac = autocomplete_new();
|
||||||
}
|
}
|
||||||
my_jid = jid_create(jabber_get_fulljid());
|
my_jid = jid_create(session_get_fulljid());
|
||||||
|
|
||||||
ptr = xmpp_stanza_get_children(ptr);
|
ptr = xmpp_stanza_get_children(ptr);
|
||||||
while (ptr) {
|
while (ptr) {
|
||||||
@ -333,7 +333,7 @@ _bookmark_result_id_handler(xmpp_stanza_t *const stanza, void *const userdata)
|
|||||||
if (autojoin_val) {
|
if (autojoin_val) {
|
||||||
Jid *room_jid;
|
Jid *room_jid;
|
||||||
|
|
||||||
char *account_name = jabber_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 (nick == NULL) {
|
if (nick == NULL) {
|
||||||
nick = account->muc_nick;
|
nick = account->muc_nick;
|
||||||
|
@ -255,7 +255,7 @@ _connection_handler(xmpp_conn_t *const conn, const xmpp_conn_event_t status, con
|
|||||||
log_debug("Connection handler: XMPP_CONN_CONNECT");
|
log_debug("Connection handler: XMPP_CONN_CONNECT");
|
||||||
connection_set_status(JABBER_CONNECTED);
|
connection_set_status(JABBER_CONNECTED);
|
||||||
|
|
||||||
jabber_login_success(connection_is_secured());
|
session_login_success(connection_is_secured());
|
||||||
|
|
||||||
} else if (status == XMPP_CONN_DISCONNECT) {
|
} else if (status == XMPP_CONN_DISCONNECT) {
|
||||||
log_debug("Connection handler: XMPP_CONN_DISCONNECT");
|
log_debug("Connection handler: XMPP_CONN_DISCONNECT");
|
||||||
@ -263,12 +263,12 @@ _connection_handler(xmpp_conn_t *const conn, const xmpp_conn_event_t status, con
|
|||||||
// lost connection for unknown reason
|
// lost connection for unknown reason
|
||||||
if (connection_get_status() == JABBER_CONNECTED) {
|
if (connection_get_status() == JABBER_CONNECTED) {
|
||||||
log_debug("Connection handler: Lost connection for unknown reason");
|
log_debug("Connection handler: Lost connection for unknown reason");
|
||||||
jabber_lost_connection();
|
session_lost_connection();
|
||||||
|
|
||||||
// login attempt failed
|
// login attempt failed
|
||||||
} else if (connection_get_status() != JABBER_DISCONNECTING) {
|
} else if (connection_get_status() != JABBER_DISCONNECTING) {
|
||||||
log_debug("Connection handler: Login failed");
|
log_debug("Connection handler: Login failed");
|
||||||
jabber_login_failed();
|
session_login_failed();
|
||||||
}
|
}
|
||||||
|
|
||||||
// close stream response from server after disconnect is handled too
|
// close stream response from server after disconnect is handled too
|
||||||
|
@ -57,4 +57,8 @@ void connection_free_presence_msg(void);
|
|||||||
void connection_free_domain(void);
|
void connection_free_domain(void);
|
||||||
void connection_free_log(void);
|
void connection_free_log(void);
|
||||||
|
|
||||||
|
xmpp_conn_t* connection_get_conn(void);
|
||||||
|
xmpp_ctx_t* connection_get_ctx(void);
|
||||||
|
void connection_set_priority(int priority);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
#include "xmpp/stanza.h"
|
#include "xmpp/stanza.h"
|
||||||
#include "xmpp/session.h"
|
#include "xmpp/connection.h"
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_is_valid_form_element(xmpp_stanza_t *stanza)
|
_is_valid_form_element(xmpp_stanza_t *stanza)
|
||||||
|
@ -64,6 +64,8 @@
|
|||||||
#include "xmpp/form.h"
|
#include "xmpp/form.h"
|
||||||
#include "roster_list.h"
|
#include "roster_list.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
|
#include "xmpp/connection.h"
|
||||||
|
#include "xmpp/session.h"
|
||||||
#include "xmpp/iq.h"
|
#include "xmpp/iq.h"
|
||||||
#include "xmpp/roster.h"
|
#include "xmpp/roster.h"
|
||||||
#include "plugins/plugins.h"
|
#include "plugins/plugins.h"
|
||||||
@ -243,7 +245,7 @@ iq_autoping_check(void)
|
|||||||
if (timeout > 0 && seconds_elapsed >= timeout) {
|
if (timeout > 0 && seconds_elapsed >= timeout) {
|
||||||
cons_show("Autoping response timed out afer %u seconds.", timeout);
|
cons_show("Autoping response timed out afer %u seconds.", timeout);
|
||||||
log_debug("Autoping check: timed out afer %u seconds, disconnecting", timeout);
|
log_debug("Autoping check: timed out afer %u seconds, disconnecting", timeout);
|
||||||
connection_autoping_fail();
|
session_autoping_fail();
|
||||||
autoping_wait = FALSE;
|
autoping_wait = FALSE;
|
||||||
g_timer_destroy(autoping_time);
|
g_timer_destroy(autoping_time);
|
||||||
autoping_time = NULL;
|
autoping_time = NULL;
|
||||||
@ -307,7 +309,7 @@ iq_disable_carbons(void)
|
|||||||
void
|
void
|
||||||
iq_http_upload_request(HTTPUpload *upload)
|
iq_http_upload_request(HTTPUpload *upload)
|
||||||
{
|
{
|
||||||
GSList *disco_items = connection_get_disco_items();
|
GSList *disco_items = session_get_disco_items();
|
||||||
DiscoInfo *disco_info;
|
DiscoInfo *disco_info;
|
||||||
if (disco_items && (g_slist_length(disco_items) > 0)) {
|
if (disco_items && (g_slist_length(disco_items) > 0)) {
|
||||||
while (disco_items) {
|
while (disco_items) {
|
||||||
@ -1918,7 +1920,7 @@ _disco_info_response_id_handler_onconnect(xmpp_stanza_t *const stanza, void *con
|
|||||||
if (query) {
|
if (query) {
|
||||||
xmpp_stanza_t *child = xmpp_stanza_get_children(query);
|
xmpp_stanza_t *child = xmpp_stanza_get_children(query);
|
||||||
|
|
||||||
GSList *disco_items = connection_get_disco_items();
|
GSList *disco_items = session_get_disco_items();
|
||||||
DiscoInfo *disco_info;
|
DiscoInfo *disco_info;
|
||||||
if (disco_items && (g_slist_length(disco_items) > 0)) {
|
if (disco_items && (g_slist_length(disco_items) > 0)) {
|
||||||
while (disco_items) {
|
while (disco_items) {
|
||||||
@ -2053,7 +2055,7 @@ _disco_items_result_handler(xmpp_stanza_t *const stanza)
|
|||||||
DiscoInfo *info = malloc(sizeof(struct disco_info_t));
|
DiscoInfo *info = malloc(sizeof(struct disco_info_t));
|
||||||
info->item = strdup(item->jid);
|
info->item = strdup(item->jid);
|
||||||
info->features = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL);
|
info->features = g_hash_table_new_full(g_str_hash, g_str_equal, free, NULL);
|
||||||
connection_set_disco_items(g_slist_append(connection_get_disco_items(), info));
|
session_set_disco_items(g_slist_append(session_get_disco_items(), info));
|
||||||
iq_disco_info_request_onconnect(info->item);
|
iq_disco_info_request_onconnect(info->item);
|
||||||
res_items = g_slist_next(res_items);
|
res_items = g_slist_next(res_items);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#ifndef XMPP_IQ_H
|
#ifndef XMPP_IQ_H
|
||||||
#define XMPP_IQ_H
|
#define XMPP_IQ_H
|
||||||
|
|
||||||
|
typedef int(*ProfIdCallback)(xmpp_stanza_t *const stanza, void *const userdata);
|
||||||
|
|
||||||
void iq_handlers_init(void);
|
void iq_handlers_init(void);
|
||||||
void iq_send_stanza(xmpp_stanza_t *const stanza);
|
void iq_send_stanza(xmpp_stanza_t *const stanza);
|
||||||
void iq_id_handler_add(const char *const id, ProfIdCallback func, void *userdata);
|
void iq_id_handler_add(const char *const id, ProfIdCallback func, void *userdata);
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
#include "xmpp/roster.h"
|
#include "xmpp/roster.h"
|
||||||
#include "roster_list.h"
|
#include "roster_list.h"
|
||||||
#include "xmpp/stanza.h"
|
#include "xmpp/stanza.h"
|
||||||
|
#include "xmpp/connection.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
#include "pgp/gpg.h"
|
#include "pgp/gpg.h"
|
||||||
#include "plugins/plugins.h"
|
#include "plugins/plugins.h"
|
||||||
@ -204,7 +205,7 @@ message_send_chat_pgp(const char *const barejid, const char *const msg)
|
|||||||
|
|
||||||
xmpp_stanza_t *message = NULL;
|
xmpp_stanza_t *message = NULL;
|
||||||
#ifdef HAVE_LIBGPGME
|
#ifdef HAVE_LIBGPGME
|
||||||
char *account_name = jabber_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 (account->pgp_keyid) {
|
if (account->pgp_keyid) {
|
||||||
Jid *jidp = jid_create(jid);
|
Jid *jidp = jid_create(jid);
|
||||||
@ -739,7 +740,7 @@ _handle_carbons(xmpp_stanza_t *const stanza)
|
|||||||
|
|
||||||
Jid *jid_from = jid_create(from);
|
Jid *jid_from = jid_create(from);
|
||||||
Jid *jid_to = jid_create(to);
|
Jid *jid_to = jid_create(to);
|
||||||
Jid *my_jid = jid_create(jabber_get_fulljid());
|
Jid *my_jid = jid_create(session_get_fulljid());
|
||||||
|
|
||||||
// check for and deal with message
|
// check for and deal with message
|
||||||
xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(message, STANZA_NAME_BODY);
|
xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(message, STANZA_NAME_BODY);
|
||||||
|
@ -251,7 +251,7 @@ presence_send(const resource_presence_t presence_type, const char *const msg, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
xmpp_ctx_t * const ctx = connection_get_ctx();
|
xmpp_ctx_t * const ctx = connection_get_ctx();
|
||||||
const int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(), presence_type);
|
const int pri = accounts_get_priority_for_presence_type(session_get_account_name(), presence_type);
|
||||||
const char *show = stanza_get_presence_string_from_type(presence_type);
|
const char *show = stanza_get_presence_string_from_type(presence_type);
|
||||||
|
|
||||||
connection_set_presence_msg(msg);
|
connection_set_presence_msg(msg);
|
||||||
@ -290,7 +290,7 @@ presence_send(const resource_presence_t presence_type, const char *const msg, co
|
|||||||
if (last == NULL) {
|
if (last == NULL) {
|
||||||
last = STANZA_TEXT_ONLINE;
|
last = STANZA_TEXT_ONLINE;
|
||||||
}
|
}
|
||||||
char *account = jabber_get_account_name();
|
char *account = session_get_account_name();
|
||||||
accounts_set_last_presence(account, last);
|
accounts_set_last_presence(account, last);
|
||||||
accounts_set_last_status(account, msg);
|
accounts_set_last_status(account, msg);
|
||||||
free(id);
|
free(id);
|
||||||
@ -331,10 +331,10 @@ presence_join_room(const char *const room, const char *const nick, const char *c
|
|||||||
log_debug("Sending room join presence to: %s", jid->fulljid);
|
log_debug("Sending room join presence to: %s", jid->fulljid);
|
||||||
xmpp_ctx_t *ctx = connection_get_ctx();
|
xmpp_ctx_t *ctx = connection_get_ctx();
|
||||||
resource_presence_t presence_type =
|
resource_presence_t presence_type =
|
||||||
accounts_get_last_presence(jabber_get_account_name());
|
accounts_get_last_presence(session_get_account_name());
|
||||||
const char *show = stanza_get_presence_string_from_type(presence_type);
|
const char *show = stanza_get_presence_string_from_type(presence_type);
|
||||||
char *status = connection_get_presence_msg();
|
char *status = connection_get_presence_msg();
|
||||||
int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(),
|
int pri = accounts_get_priority_for_presence_type(session_get_account_name(),
|
||||||
presence_type);
|
presence_type);
|
||||||
|
|
||||||
xmpp_stanza_t *presence = stanza_create_room_join_presence(ctx, jid->fulljid, passwd);
|
xmpp_stanza_t *presence = stanza_create_room_join_presence(ctx, jid->fulljid, passwd);
|
||||||
@ -358,10 +358,10 @@ presence_change_room_nick(const char *const room, const char *const nick)
|
|||||||
log_debug("Sending room nickname change to: %s, nick: %s", room, nick);
|
log_debug("Sending room nickname change to: %s, nick: %s", room, nick);
|
||||||
xmpp_ctx_t *ctx = connection_get_ctx();
|
xmpp_ctx_t *ctx = connection_get_ctx();
|
||||||
resource_presence_t presence_type =
|
resource_presence_t presence_type =
|
||||||
accounts_get_last_presence(jabber_get_account_name());
|
accounts_get_last_presence(session_get_account_name());
|
||||||
const char *show = stanza_get_presence_string_from_type(presence_type);
|
const char *show = stanza_get_presence_string_from_type(presence_type);
|
||||||
char *status = connection_get_presence_msg();
|
char *status = connection_get_presence_msg();
|
||||||
int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(),
|
int pri = accounts_get_priority_for_presence_type(session_get_account_name(),
|
||||||
presence_type);
|
presence_type);
|
||||||
|
|
||||||
char *full_room_jid = create_fulljid(room, nick);
|
char *full_room_jid = create_fulljid(room, nick);
|
||||||
@ -538,7 +538,7 @@ _unavailable_handler(xmpp_stanza_t *const stanza)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (from_jid->resourcepart) {
|
if (from_jid->resourcepart) {
|
||||||
connection_remove_available_resource(from_jid->resourcepart);
|
session_remove_available_resource(from_jid->resourcepart);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -644,7 +644,7 @@ _available_handler(xmpp_stanza_t *const stanza)
|
|||||||
Resource *resource = stanza_resource_from_presence(xmpp_presence);
|
Resource *resource = stanza_resource_from_presence(xmpp_presence);
|
||||||
|
|
||||||
if (g_strcmp0(xmpp_presence->jid->barejid, my_jid->barejid) == 0) {
|
if (g_strcmp0(xmpp_presence->jid->barejid, my_jid->barejid) == 0) {
|
||||||
connection_add_available_resource(resource);
|
session_add_available_resource(resource);
|
||||||
} else {
|
} else {
|
||||||
char *pgpsig = NULL;
|
char *pgpsig = NULL;
|
||||||
xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_SIGNED);
|
xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_SIGNED);
|
||||||
@ -721,7 +721,7 @@ _muc_user_handler(xmpp_stanza_t *const stanza)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle self presence
|
// handle self presence
|
||||||
if (stanza_is_muc_self_presence(stanza, jabber_get_fulljid())) {
|
if (stanza_is_muc_self_presence(stanza, session_get_fulljid())) {
|
||||||
log_debug("Room self presence received from %s", from_jid->fulljid);
|
log_debug("Room self presence received from %s", from_jid->fulljid);
|
||||||
|
|
||||||
// self unavailable
|
// self unavailable
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
#include "config/preferences.h"
|
#include "config/preferences.h"
|
||||||
#include "xmpp/session.h"
|
#include "xmpp/session.h"
|
||||||
#include "xmpp/iq.h"
|
#include "xmpp/iq.h"
|
||||||
|
#include "xmpp/connection.h"
|
||||||
#include "xmpp/roster.h"
|
#include "xmpp/roster.h"
|
||||||
#include "roster_list.h"
|
#include "roster_list.h"
|
||||||
#include "xmpp/stanza.h"
|
#include "xmpp/stanza.h"
|
||||||
@ -217,7 +218,7 @@ roster_set_handler(xmpp_stanza_t *const stanza)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if from attribute exists and it is not current users barejid, ignore push
|
// if from attribute exists and it is not current users barejid, ignore push
|
||||||
Jid *my_jid = jid_create(jabber_get_fulljid());
|
Jid *my_jid = jid_create(session_get_fulljid());
|
||||||
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
const char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
||||||
if (from && (strcmp(from, my_jid->barejid) != 0)) {
|
if (from && (strcmp(from, my_jid->barejid) != 0)) {
|
||||||
jid_destroy(my_jid);
|
jid_destroy(my_jid);
|
||||||
|
@ -86,17 +86,17 @@ static struct {
|
|||||||
|
|
||||||
static GTimer *reconnect_timer;
|
static GTimer *reconnect_timer;
|
||||||
|
|
||||||
static jabber_conn_status_t _jabber_connect(const char *const fulljid, const char *const passwd,
|
static jabber_conn_status_t _session_connect(const char *const fulljid, const char *const passwd,
|
||||||
const char *const altdomain, int port, const char *const tls_policy);
|
const char *const altdomain, int port, const char *const tls_policy);
|
||||||
|
|
||||||
static void _jabber_reconnect(void);
|
static void _session_reconnect(void);
|
||||||
|
|
||||||
void _connection_free_saved_account(void);
|
static void _session_free_saved_account(void);
|
||||||
void _connection_free_saved_details(void);
|
static void _session_free_saved_details(void);
|
||||||
void _connection_free_session_data(void);
|
static void _session_free_session_data(void);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_info_destroy(DiscoInfo *info)
|
_session_info_destroy(DiscoInfo *info)
|
||||||
{
|
{
|
||||||
if (info) {
|
if (info) {
|
||||||
free(info->item);
|
free(info->item);
|
||||||
@ -108,7 +108,7 @@ _info_destroy(DiscoInfo *info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
jabber_init(void)
|
session_init(void)
|
||||||
{
|
{
|
||||||
log_info("Initialising XMPP");
|
log_info("Initialising XMPP");
|
||||||
connection_init();
|
connection_init();
|
||||||
@ -120,7 +120,7 @@ jabber_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
jabber_conn_status_t
|
jabber_conn_status_t
|
||||||
jabber_connect_with_account(const ProfAccount *const account)
|
session_connect_with_account(const ProfAccount *const account)
|
||||||
{
|
{
|
||||||
assert(account != NULL);
|
assert(account != NULL);
|
||||||
|
|
||||||
@ -139,14 +139,14 @@ jabber_connect_with_account(const ProfAccount *const account)
|
|||||||
// connect with fulljid
|
// connect with fulljid
|
||||||
Jid *jidp = jid_create_from_bare_and_resource(account->jid, account->resource);
|
Jid *jidp = jid_create_from_bare_and_resource(account->jid, account->resource);
|
||||||
jabber_conn_status_t result =
|
jabber_conn_status_t result =
|
||||||
_jabber_connect(jidp->fulljid, account->password, account->server, account->port, account->tls_policy);
|
_session_connect(jidp->fulljid, account->password, account->server, account->port, account->tls_policy);
|
||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
jabber_conn_status_t
|
jabber_conn_status_t
|
||||||
jabber_connect_with_details(const char *const jid, const char *const passwd, const char *const altdomain,
|
session_connect_with_details(const char *const jid, const char *const passwd, const char *const altdomain,
|
||||||
const int port, const char *const tls_policy)
|
const int port, const char *const tls_policy)
|
||||||
{
|
{
|
||||||
assert(jid != NULL);
|
assert(jid != NULL);
|
||||||
@ -185,7 +185,7 @@ jabber_connect_with_details(const char *const jid, const char *const passwd, con
|
|||||||
// connect with fulljid
|
// connect with fulljid
|
||||||
log_info("Connecting without account, JID: %s", saved_details.jid);
|
log_info("Connecting without account, JID: %s", saved_details.jid);
|
||||||
|
|
||||||
return _jabber_connect(
|
return _session_connect(
|
||||||
saved_details.jid,
|
saved_details.jid,
|
||||||
passwd,
|
passwd,
|
||||||
saved_details.altdomain,
|
saved_details.altdomain,
|
||||||
@ -194,19 +194,19 @@ jabber_connect_with_details(const char *const jid, const char *const passwd, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
connection_autoping_fail(void)
|
session_autoping_fail(void)
|
||||||
{
|
{
|
||||||
if (connection_get_status() == JABBER_CONNECTED) {
|
if (connection_get_status() == JABBER_CONNECTED) {
|
||||||
log_info("Closing connection");
|
log_info("Closing connection");
|
||||||
char *account_name = jabber_get_account_name();
|
char *account_name = session_get_account_name();
|
||||||
const char *fulljid = jabber_get_fulljid();
|
const char *fulljid = session_get_fulljid();
|
||||||
plugins_on_disconnect(account_name, fulljid);
|
plugins_on_disconnect(account_name, fulljid);
|
||||||
accounts_set_last_activity(jabber_get_account_name());
|
accounts_set_last_activity(session_get_account_name());
|
||||||
connection_set_status(JABBER_DISCONNECTING);
|
connection_set_status(JABBER_DISCONNECTING);
|
||||||
xmpp_disconnect(connection_get_conn());
|
xmpp_disconnect(connection_get_conn());
|
||||||
|
|
||||||
while (connection_get_status() == JABBER_DISCONNECTING) {
|
while (connection_get_status() == JABBER_DISCONNECTING) {
|
||||||
jabber_process_events(10);
|
session_process_events(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
connection_free_conn();
|
connection_free_conn();
|
||||||
@ -218,28 +218,28 @@ connection_autoping_fail(void)
|
|||||||
|
|
||||||
connection_set_status(JABBER_DISCONNECTED);
|
connection_set_status(JABBER_DISCONNECTED);
|
||||||
|
|
||||||
jabber_lost_connection();
|
session_lost_connection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
jabber_disconnect(void)
|
session_disconnect(void)
|
||||||
{
|
{
|
||||||
// if connected, send end stream and wait for response
|
// if connected, send end stream and wait for response
|
||||||
if (connection_get_status() == JABBER_CONNECTED) {
|
if (connection_get_status() == JABBER_CONNECTED) {
|
||||||
char *account_name = jabber_get_account_name();
|
char *account_name = session_get_account_name();
|
||||||
const char *fulljid = jabber_get_fulljid();
|
const char *fulljid = session_get_fulljid();
|
||||||
plugins_on_disconnect(account_name, fulljid);
|
plugins_on_disconnect(account_name, fulljid);
|
||||||
log_info("Closing connection");
|
log_info("Closing connection");
|
||||||
accounts_set_last_activity(jabber_get_account_name());
|
accounts_set_last_activity(session_get_account_name());
|
||||||
connection_set_status(JABBER_DISCONNECTING);
|
connection_set_status(JABBER_DISCONNECTING);
|
||||||
xmpp_disconnect(connection_get_conn());
|
xmpp_disconnect(connection_get_conn());
|
||||||
|
|
||||||
while (connection_get_status() == JABBER_DISCONNECTING) {
|
while (connection_get_status() == JABBER_DISCONNECTING) {
|
||||||
jabber_process_events(10);
|
session_process_events(10);
|
||||||
}
|
}
|
||||||
_connection_free_saved_account();
|
_session_free_saved_account();
|
||||||
_connection_free_saved_details();
|
_session_free_saved_details();
|
||||||
_connection_free_session_data();
|
_session_free_session_data();
|
||||||
|
|
||||||
connection_free_conn();
|
connection_free_conn();
|
||||||
connection_free_ctx();
|
connection_free_ctx();
|
||||||
@ -252,17 +252,17 @@ jabber_disconnect(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
jabber_shutdown(void)
|
session_shutdown(void)
|
||||||
{
|
{
|
||||||
_connection_free_saved_account();
|
_session_free_saved_account();
|
||||||
_connection_free_saved_details();
|
_session_free_saved_details();
|
||||||
_connection_free_session_data();
|
_session_free_session_data();
|
||||||
xmpp_shutdown();
|
xmpp_shutdown();
|
||||||
connection_free_log();
|
connection_free_log();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
jabber_process_events(int millis)
|
session_process_events(int millis)
|
||||||
{
|
{
|
||||||
int reconnect_sec;
|
int reconnect_sec;
|
||||||
|
|
||||||
@ -279,7 +279,7 @@ jabber_process_events(int millis)
|
|||||||
if ((reconnect_sec != 0) && reconnect_timer) {
|
if ((reconnect_sec != 0) && reconnect_timer) {
|
||||||
int elapsed_sec = g_timer_elapsed(reconnect_timer, NULL);
|
int elapsed_sec = g_timer_elapsed(reconnect_timer, NULL);
|
||||||
if (elapsed_sec > reconnect_sec) {
|
if (elapsed_sec > reconnect_sec) {
|
||||||
_jabber_reconnect();
|
_session_reconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -289,19 +289,19 @@ jabber_process_events(int millis)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GList*
|
GList*
|
||||||
jabber_get_available_resources(void)
|
session_get_available_resources(void)
|
||||||
{
|
{
|
||||||
return g_hash_table_get_values(available_resources);
|
return g_hash_table_get_values(available_resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
GSList*
|
GSList*
|
||||||
connection_get_disco_items(void)
|
session_get_disco_items(void)
|
||||||
{
|
{
|
||||||
return (disco_items);
|
return (disco_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
jabber_service_supports(const char *const feature)
|
session_service_supports(const char *const feature)
|
||||||
{
|
{
|
||||||
DiscoInfo *disco_info;
|
DiscoInfo *disco_info;
|
||||||
while (disco_items) {
|
while (disco_items) {
|
||||||
@ -316,31 +316,31 @@ jabber_service_supports(const char *const feature)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
connection_set_disco_items(GSList *_disco_items)
|
session_set_disco_items(GSList *_disco_items)
|
||||||
{
|
{
|
||||||
disco_items = _disco_items;
|
disco_items = _disco_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
jabber_get_fulljid(void)
|
session_get_fulljid(void)
|
||||||
{
|
{
|
||||||
return xmpp_conn_get_jid(connection_get_conn());
|
return xmpp_conn_get_jid(connection_get_conn());
|
||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
jabber_get_account_name(void)
|
session_get_account_name(void)
|
||||||
{
|
{
|
||||||
return saved_account.name;
|
return saved_account.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
jabber_create_uuid(void)
|
session_create_uuid(void)
|
||||||
{
|
{
|
||||||
return xmpp_uuid_gen(connection_get_ctx());
|
return xmpp_uuid_gen(connection_get_ctx());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
jabber_free_uuid(char *uuid)
|
session_free_uuid(char *uuid)
|
||||||
{
|
{
|
||||||
if (uuid) {
|
if (uuid) {
|
||||||
xmpp_free(connection_get_ctx(), uuid);
|
xmpp_free(connection_get_ctx(), uuid);
|
||||||
@ -348,26 +348,26 @@ jabber_free_uuid(char *uuid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
connection_add_available_resource(Resource *resource)
|
session_add_available_resource(Resource *resource)
|
||||||
{
|
{
|
||||||
g_hash_table_replace(available_resources, strdup(resource->name), resource);
|
g_hash_table_replace(available_resources, strdup(resource->name), resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
connection_remove_available_resource(const char *const resource)
|
session_remove_available_resource(const char *const resource)
|
||||||
{
|
{
|
||||||
g_hash_table_remove(available_resources, resource);
|
g_hash_table_remove(available_resources, resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_connection_free_saved_account(void)
|
_session_free_saved_account(void)
|
||||||
{
|
{
|
||||||
FREE_SET_NULL(saved_account.name);
|
FREE_SET_NULL(saved_account.name);
|
||||||
FREE_SET_NULL(saved_account.passwd);
|
FREE_SET_NULL(saved_account.passwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_connection_free_saved_details(void)
|
_session_free_saved_details(void)
|
||||||
{
|
{
|
||||||
FREE_SET_NULL(saved_details.name);
|
FREE_SET_NULL(saved_details.name);
|
||||||
FREE_SET_NULL(saved_details.jid);
|
FREE_SET_NULL(saved_details.jid);
|
||||||
@ -377,9 +377,9 @@ _connection_free_saved_details(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_connection_free_session_data(void)
|
_session_free_session_data(void)
|
||||||
{
|
{
|
||||||
g_slist_free_full(disco_items, (GDestroyNotify)_info_destroy);
|
g_slist_free_full(disco_items, (GDestroyNotify)_session_info_destroy);
|
||||||
disco_items = NULL;
|
disco_items = NULL;
|
||||||
g_hash_table_remove_all(available_resources);
|
g_hash_table_remove_all(available_resources);
|
||||||
chat_sessions_clear();
|
chat_sessions_clear();
|
||||||
@ -387,7 +387,7 @@ _connection_free_session_data(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
jabber_login_success(int secured)
|
session_login_success(int secured)
|
||||||
{
|
{
|
||||||
// logged in with account
|
// logged in with account
|
||||||
if (saved_account.name) {
|
if (saved_account.name) {
|
||||||
@ -404,10 +404,10 @@ jabber_login_success(int secured)
|
|||||||
saved_account.name = strdup(saved_details.name);
|
saved_account.name = strdup(saved_details.name);
|
||||||
saved_account.passwd = strdup(saved_details.passwd);
|
saved_account.passwd = strdup(saved_details.passwd);
|
||||||
|
|
||||||
_connection_free_saved_details();
|
_session_free_saved_details();
|
||||||
}
|
}
|
||||||
|
|
||||||
Jid *my_jid = jid_create(jabber_get_fulljid());
|
Jid *my_jid = jid_create(session_get_fulljid());
|
||||||
connection_set_domain(my_jid->domainpart);
|
connection_set_domain(my_jid->domainpart);
|
||||||
jid_destroy(my_jid);
|
jid_destroy(my_jid);
|
||||||
|
|
||||||
@ -440,27 +440,27 @@ jabber_login_success(int secured)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
jabber_login_failed(void)
|
session_login_failed(void)
|
||||||
{
|
{
|
||||||
if (reconnect_timer == NULL) {
|
if (reconnect_timer == NULL) {
|
||||||
log_debug("Connection handler: No reconnect timer");
|
log_debug("Connection handler: No reconnect timer");
|
||||||
sv_ev_failed_login();
|
sv_ev_failed_login();
|
||||||
_connection_free_saved_account();
|
_session_free_saved_account();
|
||||||
_connection_free_saved_details();
|
_session_free_saved_details();
|
||||||
_connection_free_session_data();
|
_session_free_session_data();
|
||||||
} else {
|
} else {
|
||||||
log_debug("Connection handler: Restarting reconnect timer");
|
log_debug("Connection handler: Restarting reconnect timer");
|
||||||
if (prefs_get_reconnect() != 0) {
|
if (prefs_get_reconnect() != 0) {
|
||||||
g_timer_start(reconnect_timer);
|
g_timer_start(reconnect_timer);
|
||||||
}
|
}
|
||||||
// free resources but leave saved_user untouched
|
// free resources but leave saved_user untouched
|
||||||
_connection_free_session_data();
|
_session_free_session_data();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBMESODE
|
#ifdef HAVE_LIBMESODE
|
||||||
TLSCertificate*
|
TLSCertificate*
|
||||||
jabber_get_tls_peer_cert(void)
|
session_get_tls_peer_cert(void)
|
||||||
{
|
{
|
||||||
xmpp_tlscert_t *xmpptlscert = xmpp_conn_tls_peer_cert(connection_get_conn());
|
xmpp_tlscert_t *xmpptlscert = xmpp_conn_tls_peer_cert(connection_get_conn());
|
||||||
int version = xmpp_conn_tlscert_version(xmpptlscert);
|
int version = xmpp_conn_tlscert_version(xmpptlscert);
|
||||||
@ -483,7 +483,7 @@ jabber_get_tls_peer_cert(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
jabber_conn_is_secured(void)
|
session_conn_is_secured(void)
|
||||||
{
|
{
|
||||||
if (connection_get_status() == JABBER_CONNECTED) {
|
if (connection_get_status() == JABBER_CONNECTED) {
|
||||||
return xmpp_conn_is_secured(connection_get_conn()) == 0 ? FALSE : TRUE;
|
return xmpp_conn_is_secured(connection_get_conn()) == 0 ? FALSE : TRUE;
|
||||||
@ -493,7 +493,7 @@ jabber_conn_is_secured(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
jabber_send_stanza(const char *const stanza)
|
session_send_stanza(const char *const stanza)
|
||||||
{
|
{
|
||||||
if (connection_get_status() != JABBER_CONNECTED) {
|
if (connection_get_status() != JABBER_CONNECTED) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -504,7 +504,7 @@ jabber_send_stanza(const char *const stanza)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static jabber_conn_status_t
|
static jabber_conn_status_t
|
||||||
_jabber_connect(const char *const fulljid, const char *const passwd, const char *const altdomain, int port,
|
_session_connect(const char *const fulljid, const char *const passwd, const char *const altdomain, int port,
|
||||||
const char *const tls_policy)
|
const char *const tls_policy)
|
||||||
{
|
{
|
||||||
assert(fulljid != NULL);
|
assert(fulljid != NULL);
|
||||||
@ -534,7 +534,7 @@ _jabber_connect(const char *const fulljid, const char *const passwd, const char
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_jabber_reconnect(void)
|
_session_reconnect(void)
|
||||||
{
|
{
|
||||||
// reconnect with account.
|
// reconnect with account.
|
||||||
ProfAccount *account = accounts_get_account(saved_account.name);
|
ProfAccount *account = accounts_get_account(saved_account.name);
|
||||||
@ -544,22 +544,22 @@ _jabber_reconnect(void)
|
|||||||
} else {
|
} else {
|
||||||
char *fulljid = create_fulljid(account->jid, account->resource);
|
char *fulljid = create_fulljid(account->jid, account->resource);
|
||||||
log_debug("Attempting reconnect with account %s", account->name);
|
log_debug("Attempting reconnect with account %s", account->name);
|
||||||
_jabber_connect(fulljid, saved_account.passwd, account->server, account->port, account->tls_policy);
|
_session_connect(fulljid, saved_account.passwd, account->server, account->port, account->tls_policy);
|
||||||
free(fulljid);
|
free(fulljid);
|
||||||
g_timer_start(reconnect_timer);
|
g_timer_start(reconnect_timer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
jabber_lost_connection(void)
|
session_lost_connection(void)
|
||||||
{
|
{
|
||||||
sv_ev_lost_connection();
|
sv_ev_lost_connection();
|
||||||
if (prefs_get_reconnect() != 0) {
|
if (prefs_get_reconnect() != 0) {
|
||||||
assert(reconnect_timer == NULL);
|
assert(reconnect_timer == NULL);
|
||||||
reconnect_timer = g_timer_new();
|
reconnect_timer = g_timer_new();
|
||||||
} else {
|
} else {
|
||||||
_connection_free_saved_account();
|
_session_free_saved_account();
|
||||||
_connection_free_saved_details();
|
_session_free_saved_details();
|
||||||
}
|
}
|
||||||
_connection_free_session_data();
|
_session_free_session_data();
|
||||||
}
|
}
|
||||||
|
@ -46,21 +46,13 @@
|
|||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
typedef int(*ProfIdCallback)(xmpp_stanza_t *const stanza, void *const userdata);
|
void session_login_success(int secured);
|
||||||
|
void session_login_failed(void);
|
||||||
xmpp_conn_t* connection_get_conn(void);
|
void session_lost_connection(void);
|
||||||
xmpp_ctx_t* connection_get_ctx(void);
|
GSList* session_get_disco_items(void);
|
||||||
void connection_set_priority(int priority);
|
void session_set_disco_items(GSList *_disco_items);
|
||||||
void connection_set_presence_message(const char *const message);
|
void session_autoping_fail(void);
|
||||||
void connection_add_available_resource(Resource *resource);
|
void session_remove_available_resource(const char *const resource);
|
||||||
void connection_remove_available_resource(const char *const resource);
|
void session_add_available_resource(Resource *resource);
|
||||||
void connection_autoping_fail(void);
|
|
||||||
GSList* connection_get_disco_items(void);
|
|
||||||
void connection_set_disco_items(GSList *disco_items);
|
|
||||||
|
|
||||||
void jabber_login_success(int secured);
|
|
||||||
void jabber_login_failed(void);
|
|
||||||
void jabber_lost_connection(void);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
#include "xmpp/session.h"
|
#include "xmpp/session.h"
|
||||||
#include "xmpp/stanza.h"
|
#include "xmpp/stanza.h"
|
||||||
#include "xmpp/capabilities.h"
|
#include "xmpp/capabilities.h"
|
||||||
|
#include "xmpp/connection.h"
|
||||||
#include "xmpp/form.h"
|
#include "xmpp/form.h"
|
||||||
|
|
||||||
#include "muc.h"
|
#include "muc.h"
|
||||||
|
@ -110,26 +110,29 @@ typedef struct disco_info_t {
|
|||||||
GHashTable *features;
|
GHashTable *features;
|
||||||
} DiscoInfo;
|
} DiscoInfo;
|
||||||
|
|
||||||
void jabber_init(void);
|
void session_init(void);
|
||||||
jabber_conn_status_t jabber_connect_with_details(const char *const jid, const char *const passwd,
|
jabber_conn_status_t session_connect_with_details(const char *const jid, const char *const passwd,
|
||||||
const char *const altdomain, const int port, const char *const tls_policy);
|
const char *const altdomain, const int port, const char *const tls_policy);
|
||||||
jabber_conn_status_t jabber_connect_with_account(const ProfAccount *const account);
|
jabber_conn_status_t session_connect_with_account(const ProfAccount *const account);
|
||||||
void jabber_disconnect(void);
|
void session_disconnect(void);
|
||||||
void jabber_shutdown(void);
|
void session_shutdown(void);
|
||||||
void jabber_process_events(int millis);
|
void session_process_events(int millis);
|
||||||
const char* jabber_get_fulljid(void);
|
const char* session_get_fulljid(void);
|
||||||
|
char* session_get_account_name(void);
|
||||||
|
GList* session_get_available_resources(void);
|
||||||
|
char* session_create_uuid(void);
|
||||||
|
void session_free_uuid(char *uuid);
|
||||||
|
gboolean session_send_stanza(const char *const stanza);
|
||||||
|
|
||||||
|
#ifdef HAVE_LIBMESODE
|
||||||
|
TLSCertificate* session_get_tls_peer_cert(void);
|
||||||
|
#endif
|
||||||
|
gboolean session_conn_is_secured(void);
|
||||||
|
gboolean session_send_stanza(const char *const stanza);
|
||||||
|
gboolean session_service_supports(const char *const feature);
|
||||||
|
|
||||||
jabber_conn_status_t connection_get_status(void);
|
jabber_conn_status_t connection_get_status(void);
|
||||||
char *connection_get_presence_msg(void);
|
char *connection_get_presence_msg(void);
|
||||||
char* jabber_get_account_name(void);
|
|
||||||
GList* jabber_get_available_resources(void);
|
|
||||||
char* jabber_create_uuid(void);
|
|
||||||
void jabber_free_uuid(char *uuid);
|
|
||||||
#ifdef HAVE_LIBMESODE
|
|
||||||
TLSCertificate* jabber_get_tls_peer_cert(void);
|
|
||||||
#endif
|
|
||||||
gboolean jabber_conn_is_secured(void);
|
|
||||||
gboolean jabber_send_stanza(const char *const stanza);
|
|
||||||
gboolean jabber_service_supports(const char *const feature);
|
|
||||||
|
|
||||||
char* message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url);
|
char* message_send_chat(const char *const barejid, const char *const msg, const char *const oob_url);
|
||||||
char* message_send_chat_otr(const char *const barejid, const char *const msg);
|
char* message_send_chat_otr(const char *const barejid, const char *const msg);
|
||||||
|
@ -37,7 +37,7 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state)
|
|||||||
gchar *args[] = { NULL };
|
gchar *args[] = { NULL };
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_CONNECTED);
|
will_return(connection_get_status, JABBER_CONNECTED);
|
||||||
will_return(jabber_get_account_name, "account_name");
|
will_return(session_get_account_name, "account_name");
|
||||||
expect_any(accounts_get_account, name);
|
expect_any(accounts_get_account, name);
|
||||||
will_return(accounts_get_account, account);
|
will_return(accounts_get_account, account);
|
||||||
|
|
||||||
@ -796,13 +796,13 @@ void cmd_account_set_priority_updates_presence_when_account_connected_with_prese
|
|||||||
expect_any(accounts_get_last_presence, account_name);
|
expect_any(accounts_get_last_presence, account_name);
|
||||||
will_return(accounts_get_last_presence, RESOURCE_ONLINE);
|
will_return(accounts_get_last_presence, RESOURCE_ONLINE);
|
||||||
|
|
||||||
will_return(jabber_get_account_name, "a_account");
|
will_return(session_get_account_name, "a_account");
|
||||||
|
|
||||||
#ifdef HAVE_LIBGPGME
|
#ifdef HAVE_LIBGPGME
|
||||||
ProfAccount *account = account_new("a_account", "a_jid", NULL, NULL, TRUE, NULL, 5222, "a_resource",
|
ProfAccount *account = account_new("a_account", "a_jid", NULL, NULL, TRUE, NULL, 5222, "a_resource",
|
||||||
NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
NULL, NULL, 10, 10, 10, 10, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
will_return(jabber_get_account_name, "a_account");
|
will_return(session_get_account_name, "a_account");
|
||||||
expect_any(accounts_get_account, name);
|
expect_any(accounts_get_account, name);
|
||||||
will_return(accounts_get_account, account);
|
will_return(accounts_get_account, account);
|
||||||
#endif
|
#endif
|
||||||
|
@ -59,11 +59,11 @@ void cmd_connect_when_no_account(void **state)
|
|||||||
|
|
||||||
expect_cons_show("Connecting as user@server.org");
|
expect_cons_show("Connecting as user@server.org");
|
||||||
|
|
||||||
expect_string(jabber_connect_with_details, jid, "user@server.org");
|
expect_string(session_connect_with_details, jid, "user@server.org");
|
||||||
expect_string(jabber_connect_with_details, passwd, "password");
|
expect_string(session_connect_with_details, passwd, "password");
|
||||||
expect_value(jabber_connect_with_details, altdomain, NULL);
|
expect_value(session_connect_with_details, altdomain, NULL);
|
||||||
expect_value(jabber_connect_with_details, port, 0);
|
expect_value(session_connect_with_details, port, 0);
|
||||||
will_return(jabber_connect_with_details, JABBER_CONNECTING);
|
will_return(session_connect_with_details, JABBER_CONNECTING);
|
||||||
|
|
||||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
@ -82,11 +82,11 @@ void cmd_connect_fail_message(void **state)
|
|||||||
|
|
||||||
expect_cons_show("Connecting as user@server.org");
|
expect_cons_show("Connecting as user@server.org");
|
||||||
|
|
||||||
expect_any(jabber_connect_with_details, jid);
|
expect_any(session_connect_with_details, jid);
|
||||||
expect_any(jabber_connect_with_details, passwd);
|
expect_any(session_connect_with_details, passwd);
|
||||||
expect_any(jabber_connect_with_details, altdomain);
|
expect_any(session_connect_with_details, altdomain);
|
||||||
expect_any(jabber_connect_with_details, port);
|
expect_any(session_connect_with_details, port);
|
||||||
will_return(jabber_connect_with_details, JABBER_DISCONNECTED);
|
will_return(session_connect_with_details, JABBER_DISCONNECTED);
|
||||||
|
|
||||||
expect_cons_show_error("Connection attempt for user@server.org failed.");
|
expect_cons_show_error("Connection attempt for user@server.org failed.");
|
||||||
|
|
||||||
@ -107,11 +107,11 @@ void cmd_connect_lowercases_argument(void **state)
|
|||||||
|
|
||||||
expect_cons_show("Connecting as user@server.org");
|
expect_cons_show("Connecting as user@server.org");
|
||||||
|
|
||||||
expect_any(jabber_connect_with_details, jid);
|
expect_any(session_connect_with_details, jid);
|
||||||
expect_any(jabber_connect_with_details, passwd);
|
expect_any(session_connect_with_details, passwd);
|
||||||
expect_any(jabber_connect_with_details, altdomain);
|
expect_any(session_connect_with_details, altdomain);
|
||||||
expect_any(jabber_connect_with_details, port);
|
expect_any(session_connect_with_details, port);
|
||||||
will_return(jabber_connect_with_details, JABBER_CONNECTING);
|
will_return(session_connect_with_details, JABBER_CONNECTING);
|
||||||
|
|
||||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
@ -132,8 +132,8 @@ void cmd_connect_asks_password_when_not_in_account(void **state)
|
|||||||
|
|
||||||
expect_cons_show("Connecting with account jabber_org as me@jabber.org");
|
expect_cons_show("Connecting with account jabber_org as me@jabber.org");
|
||||||
|
|
||||||
expect_any(jabber_connect_with_account, account);
|
expect_any(session_connect_with_account, account);
|
||||||
will_return(jabber_connect_with_account, JABBER_CONNECTING);
|
will_return(session_connect_with_account, JABBER_CONNECTING);
|
||||||
|
|
||||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
@ -308,11 +308,11 @@ void cmd_connect_with_server_when_provided(void **state)
|
|||||||
|
|
||||||
expect_cons_show("Connecting as user@server.org");
|
expect_cons_show("Connecting as user@server.org");
|
||||||
|
|
||||||
expect_string(jabber_connect_with_details, jid, "user@server.org");
|
expect_string(session_connect_with_details, jid, "user@server.org");
|
||||||
expect_string(jabber_connect_with_details, passwd, "password");
|
expect_string(session_connect_with_details, passwd, "password");
|
||||||
expect_string(jabber_connect_with_details, altdomain, "aserver");
|
expect_string(session_connect_with_details, altdomain, "aserver");
|
||||||
expect_value(jabber_connect_with_details, port, 0);
|
expect_value(session_connect_with_details, port, 0);
|
||||||
will_return(jabber_connect_with_details, JABBER_CONNECTING);
|
will_return(session_connect_with_details, JABBER_CONNECTING);
|
||||||
|
|
||||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
@ -331,11 +331,11 @@ void cmd_connect_with_port_when_provided(void **state)
|
|||||||
|
|
||||||
expect_cons_show("Connecting as user@server.org");
|
expect_cons_show("Connecting as user@server.org");
|
||||||
|
|
||||||
expect_string(jabber_connect_with_details, jid, "user@server.org");
|
expect_string(session_connect_with_details, jid, "user@server.org");
|
||||||
expect_string(jabber_connect_with_details, passwd, "password");
|
expect_string(session_connect_with_details, passwd, "password");
|
||||||
expect_value(jabber_connect_with_details, altdomain, NULL);
|
expect_value(session_connect_with_details, altdomain, NULL);
|
||||||
expect_value(jabber_connect_with_details, port, 5432);
|
expect_value(session_connect_with_details, port, 5432);
|
||||||
will_return(jabber_connect_with_details, JABBER_CONNECTING);
|
will_return(session_connect_with_details, JABBER_CONNECTING);
|
||||||
|
|
||||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
@ -354,11 +354,11 @@ void cmd_connect_with_server_and_port_when_provided(void **state)
|
|||||||
|
|
||||||
expect_cons_show("Connecting as user@server.org");
|
expect_cons_show("Connecting as user@server.org");
|
||||||
|
|
||||||
expect_string(jabber_connect_with_details, jid, "user@server.org");
|
expect_string(session_connect_with_details, jid, "user@server.org");
|
||||||
expect_string(jabber_connect_with_details, passwd, "password");
|
expect_string(session_connect_with_details, passwd, "password");
|
||||||
expect_string(jabber_connect_with_details, altdomain, "aserver");
|
expect_string(session_connect_with_details, altdomain, "aserver");
|
||||||
expect_value(jabber_connect_with_details, port, 5432);
|
expect_value(session_connect_with_details, port, 5432);
|
||||||
will_return(jabber_connect_with_details, JABBER_CONNECTING);
|
will_return(session_connect_with_details, JABBER_CONNECTING);
|
||||||
|
|
||||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
@ -377,8 +377,8 @@ void cmd_connect_shows_message_when_connecting_with_account(void **state)
|
|||||||
|
|
||||||
expect_cons_show("Connecting with account jabber_org as user@jabber.org/laptop");
|
expect_cons_show("Connecting with account jabber_org as user@jabber.org/laptop");
|
||||||
|
|
||||||
expect_any(jabber_connect_with_account, account);
|
expect_any(session_connect_with_account, account);
|
||||||
will_return(jabber_connect_with_account, JABBER_CONNECTING);
|
will_return(session_connect_with_account, JABBER_CONNECTING);
|
||||||
|
|
||||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
@ -397,8 +397,8 @@ void cmd_connect_connects_with_account(void **state)
|
|||||||
|
|
||||||
expect_cons_show("Connecting with account jabber_org as me@jabber.org");
|
expect_cons_show("Connecting with account jabber_org as me@jabber.org");
|
||||||
|
|
||||||
expect_memory(jabber_connect_with_account, account, account, sizeof(account));
|
expect_memory(session_connect_with_account, account, account, sizeof(account));
|
||||||
will_return(jabber_connect_with_account, JABBER_CONNECTING);
|
will_return(session_connect_with_account, JABBER_CONNECTING);
|
||||||
|
|
||||||
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
gboolean result = cmd_connect(NULL, CMD_CONNECT, args);
|
||||||
assert_true(result);
|
assert_true(result);
|
||||||
|
@ -22,7 +22,7 @@ void clears_chat_sessions(void **state)
|
|||||||
chat_session_recipient_active("mike@server.org", "work", FALSE);
|
chat_session_recipient_active("mike@server.org", "work", FALSE);
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_CONNECTED);
|
will_return(connection_get_status, JABBER_CONNECTED);
|
||||||
will_return(jabber_get_fulljid, "myjid@myserver.com");
|
will_return(session_get_fulljid, "myjid@myserver.com");
|
||||||
expect_any_cons_show();
|
expect_any_cons_show();
|
||||||
|
|
||||||
gboolean result = cmd_disconnect(NULL, CMD_DISCONNECT, NULL);
|
gboolean result = cmd_disconnect(NULL, CMD_DISCONNECT, NULL);
|
||||||
|
@ -75,7 +75,7 @@ void cmd_join_uses_account_mucservice_when_no_service_specified(void **state)
|
|||||||
muc_init();
|
muc_init();
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_CONNECTED);
|
will_return(connection_get_status, JABBER_CONNECTED);
|
||||||
will_return(jabber_get_account_name, account_name);
|
will_return(session_get_account_name, account_name);
|
||||||
|
|
||||||
expect_string(accounts_get_account, name, account_name);
|
expect_string(accounts_get_account, name, account_name);
|
||||||
will_return(accounts_get_account, account);
|
will_return(accounts_get_account, account);
|
||||||
@ -100,7 +100,7 @@ void cmd_join_uses_supplied_nick(void **state)
|
|||||||
muc_init();
|
muc_init();
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_CONNECTED);
|
will_return(connection_get_status, JABBER_CONNECTED);
|
||||||
will_return(jabber_get_account_name, account_name);
|
will_return(session_get_account_name, account_name);
|
||||||
|
|
||||||
expect_string(accounts_get_account, name, account_name);
|
expect_string(accounts_get_account, name, account_name);
|
||||||
will_return(accounts_get_account, account);
|
will_return(accounts_get_account, account);
|
||||||
@ -125,7 +125,7 @@ void cmd_join_uses_account_nick_when_not_supplied(void **state)
|
|||||||
muc_init();
|
muc_init();
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_CONNECTED);
|
will_return(connection_get_status, JABBER_CONNECTED);
|
||||||
will_return(jabber_get_account_name, account_name);
|
will_return(session_get_account_name, account_name);
|
||||||
|
|
||||||
expect_string(accounts_get_account, name, account_name);
|
expect_string(accounts_get_account, name, account_name);
|
||||||
will_return(accounts_get_account, account);
|
will_return(accounts_get_account, account);
|
||||||
@ -153,7 +153,7 @@ void cmd_join_uses_password_when_supplied(void **state)
|
|||||||
muc_init();
|
muc_init();
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_CONNECTED);
|
will_return(connection_get_status, JABBER_CONNECTED);
|
||||||
will_return(jabber_get_account_name, account_name);
|
will_return(session_get_account_name, account_name);
|
||||||
|
|
||||||
expect_string(accounts_get_account, name, account_name);
|
expect_string(accounts_get_account, name, account_name);
|
||||||
will_return(accounts_get_account, account);
|
will_return(accounts_get_account, account);
|
||||||
|
@ -192,7 +192,7 @@ void cmd_otr_gen_generates_key_for_connected_account(void **state)
|
|||||||
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_CONNECTED);
|
will_return(connection_get_status, JABBER_CONNECTED);
|
||||||
will_return(jabber_get_account_name, account_name);
|
will_return(session_get_account_name, account_name);
|
||||||
|
|
||||||
expect_string(accounts_get_account, name, account_name);
|
expect_string(accounts_get_account, name, account_name);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ void cmd_rooms_uses_account_default_when_no_arg(void **state)
|
|||||||
0, 0, 0, 0, 0, strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
0, 0, 0, 0, 0, strdup("default_conf_server"), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
will_return(connection_get_status, JABBER_CONNECTED);
|
will_return(connection_get_status, JABBER_CONNECTED);
|
||||||
will_return(jabber_get_account_name, "account_name");
|
will_return(session_get_account_name, "account_name");
|
||||||
expect_any(accounts_get_account, name);
|
expect_any(accounts_get_account, name);
|
||||||
will_return(accounts_get_account, account);
|
will_return(accounts_get_account, account);
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
|
|
||||||
// connection functions
|
// connection functions
|
||||||
void jabber_init(void) {}
|
void session_init(void) {}
|
||||||
|
|
||||||
jabber_conn_status_t jabber_connect_with_details(const char * const jid,
|
jabber_conn_status_t session_connect_with_details(const char * const jid,
|
||||||
const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy)
|
const char * const passwd, const char * const altdomain, const int port, const char *const tls_policy)
|
||||||
{
|
{
|
||||||
check_expected(jid);
|
check_expected(jid);
|
||||||
@ -18,31 +18,43 @@ jabber_conn_status_t jabber_connect_with_details(const char * const jid,
|
|||||||
return (jabber_conn_status_t)mock();
|
return (jabber_conn_status_t)mock();
|
||||||
}
|
}
|
||||||
|
|
||||||
jabber_conn_status_t jabber_connect_with_account(const ProfAccount * const account)
|
jabber_conn_status_t session_connect_with_account(const ProfAccount * const account)
|
||||||
{
|
{
|
||||||
check_expected(account);
|
check_expected(account);
|
||||||
return (jabber_conn_status_t)mock();
|
return (jabber_conn_status_t)mock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void jabber_disconnect(void) {}
|
void session_disconnect(void) {}
|
||||||
void jabber_shutdown(void) {}
|
void session_shutdown(void) {}
|
||||||
void jabber_process_events(int millis) {}
|
void session_process_events(int millis) {}
|
||||||
const char * jabber_get_fulljid(void)
|
const char * session_get_fulljid(void)
|
||||||
{
|
{
|
||||||
return (char *)mock();
|
return (char *)mock();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * jabber_get_domain(void)
|
const char * session_get_domain(void)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* jabber_create_uuid(void)
|
gboolean session_conn_is_secured(void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TLSCertificate*
|
||||||
|
session_get_tls_peer_cert(void)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void jabber_free_uuid(char * uuid) {}
|
|
||||||
|
char* session_create_uuid(void)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void session_free_uuid(char * uuid) {}
|
||||||
|
|
||||||
jabber_conn_status_t connection_get_status(void)
|
jabber_conn_status_t connection_get_status(void)
|
||||||
{
|
{
|
||||||
@ -54,24 +66,24 @@ char* connection_get_presence_msg(void)
|
|||||||
return (char*)mock();
|
return (char*)mock();
|
||||||
}
|
}
|
||||||
|
|
||||||
char* jabber_get_account_name(void)
|
char* session_get_account_name(void)
|
||||||
{
|
{
|
||||||
return (char*)mock();
|
return (char*)mock();
|
||||||
}
|
}
|
||||||
|
|
||||||
GList * jabber_get_available_resources(void)
|
GList * session_get_available_resources(void)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
jabber_send_stanza(const char *const stanza)
|
session_send_stanza(const char *const stanza)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
jabber_service_supports(const char *const feature)
|
session_service_supports(const char *const feature)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user