mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Bind jabber functions in main.c
This commit is contained in:
parent
5a5b1340aa
commit
581f58e47f
@ -29,11 +29,19 @@
|
||||
|
||||
#include "profanity.h"
|
||||
|
||||
#include "xmpp/xmpp.h"
|
||||
|
||||
static gboolean disable_tls = FALSE;
|
||||
static gboolean version = FALSE;
|
||||
static char *log = "INFO";
|
||||
static char *account_name = NULL;
|
||||
|
||||
static void
|
||||
_init_modules(void)
|
||||
{
|
||||
jabber_init_module();
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@ -79,6 +87,7 @@ main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
_init_modules();
|
||||
prof_run(disable_tls, log, account_name);
|
||||
|
||||
return 0;
|
||||
|
@ -125,6 +125,7 @@ _ui_get_idle_time(void)
|
||||
unsigned long ms_elapsed = seconds_elapsed * 1000.0;
|
||||
return ms_elapsed;
|
||||
}
|
||||
//unsigned long (*ui_get_idle_time)(void) = _ui_get_idle_time;
|
||||
unsigned long (*ui_get_idle_time)(void) = _ui_get_idle_time;
|
||||
|
||||
static void
|
||||
|
@ -107,7 +107,6 @@ _jabber_init(const int disable_tls)
|
||||
(GDestroyNotify)resource_destroy);
|
||||
xmpp_initialize();
|
||||
}
|
||||
void (*jabber_init)(const int) = _jabber_init;
|
||||
|
||||
static jabber_conn_status_t
|
||||
_jabber_connect_with_account(const ProfAccount * const account)
|
||||
@ -128,7 +127,6 @@ _jabber_connect_with_account(const ProfAccount * const account)
|
||||
|
||||
return result;
|
||||
}
|
||||
jabber_conn_status_t (*jabber_connect_with_account)(const ProfAccount * const) = _jabber_connect_with_account;
|
||||
|
||||
static jabber_conn_status_t
|
||||
_jabber_connect_with_details(const char * const jid,
|
||||
@ -161,8 +159,6 @@ _jabber_connect_with_details(const char * const jid,
|
||||
log_info("Connecting without account, JID: %s", saved_details.jid);
|
||||
return _jabber_connect(saved_details.jid, passwd, saved_details.altdomain);
|
||||
}
|
||||
jabber_conn_status_t (*jabber_connect_with_details)(const char * const,
|
||||
const char * const, const char * const) = _jabber_connect_with_details;
|
||||
|
||||
static void
|
||||
_jabber_disconnect(void)
|
||||
@ -193,14 +189,12 @@ _jabber_disconnect(void)
|
||||
FREE_SET_NULL(jabber_conn.presence_message);
|
||||
FREE_SET_NULL(jabber_conn.domain);
|
||||
}
|
||||
void (*jabber_disconnect)(void) = _jabber_disconnect;
|
||||
|
||||
static void
|
||||
_jabber_shutdown(void)
|
||||
{
|
||||
xmpp_shutdown();
|
||||
}
|
||||
void (*jabber_shutdown)(void) = _jabber_shutdown;
|
||||
|
||||
static void
|
||||
_jabber_process_events(void)
|
||||
@ -222,7 +216,6 @@ _jabber_process_events(void)
|
||||
}
|
||||
|
||||
}
|
||||
void (*jabber_process_events)(void) = _jabber_process_events;
|
||||
|
||||
static void
|
||||
_jabber_set_autoping(const int seconds)
|
||||
@ -237,21 +230,18 @@ _jabber_set_autoping(const int seconds)
|
||||
}
|
||||
}
|
||||
}
|
||||
void (*jabber_set_autoping)(const int) = _jabber_set_autoping;
|
||||
|
||||
static GList *
|
||||
_jabber_get_available_resources(void)
|
||||
{
|
||||
return g_hash_table_get_values(available_resources);
|
||||
}
|
||||
GList * (*jabber_get_available_resources)(void) = _jabber_get_available_resources;
|
||||
|
||||
static jabber_conn_status_t
|
||||
_jabber_get_connection_status(void)
|
||||
{
|
||||
return (jabber_conn.conn_status);
|
||||
}
|
||||
jabber_conn_status_t (*jabber_get_connection_status)(void) = _jabber_get_connection_status;
|
||||
|
||||
xmpp_conn_t *
|
||||
connection_get_conn(void)
|
||||
@ -270,28 +260,24 @@ _jabber_get_fulljid(void)
|
||||
{
|
||||
return xmpp_conn_get_jid(jabber_conn.conn);
|
||||
}
|
||||
const char * (*jabber_get_fulljid)(void) = _jabber_get_fulljid;
|
||||
|
||||
static const char *
|
||||
_jabber_get_domain(void)
|
||||
{
|
||||
return jabber_conn.domain;
|
||||
}
|
||||
const char * (*jabber_get_domain)(void) = _jabber_get_domain;
|
||||
|
||||
static char *
|
||||
_jabber_get_presence_message(void)
|
||||
{
|
||||
return jabber_conn.presence_message;
|
||||
}
|
||||
char * (*jabber_get_presence_message)(void) = _jabber_get_presence_message;
|
||||
|
||||
static char *
|
||||
_jabber_get_account_name(void)
|
||||
{
|
||||
return saved_account.name;
|
||||
}
|
||||
char * (*jabber_get_account_name)(void) = _jabber_get_account_name;
|
||||
|
||||
void
|
||||
connection_set_presence_message(const char * const message)
|
||||
@ -629,3 +615,20 @@ _xmpp_get_file_logger()
|
||||
return file_log;
|
||||
}
|
||||
|
||||
void
|
||||
jabber_init_module(void)
|
||||
{
|
||||
jabber_init = _jabber_init;
|
||||
jabber_connect_with_account = _jabber_connect_with_account;
|
||||
jabber_connect_with_details = _jabber_connect_with_details;
|
||||
jabber_disconnect = _jabber_disconnect;
|
||||
jabber_shutdown = _jabber_shutdown;
|
||||
jabber_process_events = _jabber_process_events;
|
||||
jabber_set_autoping = _jabber_set_autoping;
|
||||
jabber_get_available_resources = _jabber_get_available_resources;
|
||||
jabber_get_connection_status = _jabber_get_connection_status;
|
||||
jabber_get_fulljid = _jabber_get_fulljid;
|
||||
jabber_get_domain = _jabber_get_domain;
|
||||
jabber_get_presence_message = _jabber_get_presence_message;
|
||||
jabber_get_account_name = _jabber_get_account_name;
|
||||
}
|
||||
|
@ -74,6 +74,8 @@ typedef struct disco_identity_t {
|
||||
char *category;
|
||||
} DiscoIdentity;
|
||||
|
||||
void jabber_init_module(void);
|
||||
|
||||
// connection functions
|
||||
void (*jabber_init)(const int disable_tls);
|
||||
jabber_conn_status_t (*jabber_connect_with_details)(const char * const jid,
|
||||
|
Loading…
Reference in New Issue
Block a user