mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Plugins: Added account_name and fulljid to prof_init hook
This commit is contained in:
parent
46687aeced
commit
b3a3351a35
@ -113,10 +113,12 @@ c_plugin_create(const char *const filename)
|
||||
}
|
||||
|
||||
void
|
||||
c_init_hook(ProfPlugin *plugin, const char *const version, const char *const status)
|
||||
c_init_hook(ProfPlugin *plugin, const char *const version, const char *const status, const char *const account_name,
|
||||
const char *const fulljid)
|
||||
{
|
||||
void *f = NULL;
|
||||
void (*func)(const char *const __version, const char *const __status);
|
||||
void (*func)(const char *const __version, const char *const __status, const char *const __account_name,
|
||||
const char *const __fulljid);
|
||||
|
||||
assert(plugin && plugin->module);
|
||||
|
||||
@ -125,10 +127,10 @@ c_init_hook(ProfPlugin *plugin, const char *const version, const char *const sta
|
||||
return;
|
||||
}
|
||||
|
||||
func = (void (*)(const char *const, const char *const))f;
|
||||
func = (void (*)(const char *const, const char *const, const char *const, const char *const))f;
|
||||
|
||||
// FIXME maybe we want to make it boolean to see if it succeeded or not?
|
||||
func(version, status);
|
||||
func(version, status, account_name, fulljid);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -43,7 +43,8 @@ ProfPlugin* c_plugin_create(const char *const filename);
|
||||
void c_plugin_destroy(ProfPlugin *plugin);
|
||||
void c_shutdown(void);
|
||||
|
||||
void c_init_hook(ProfPlugin *plugin, const char *const version, const char *const status);
|
||||
void c_init_hook(ProfPlugin *plugin, const char *const version, const char *const status, const char *const account_name,
|
||||
const char *const fulljid);
|
||||
void c_on_start_hook(ProfPlugin *plugin);
|
||||
void c_on_shutdown_hook(ProfPlugin *plugin);
|
||||
void c_on_connect_hook(ProfPlugin *plugin, const char *const account_name, const char *const fulljid);
|
||||
|
@ -114,7 +114,7 @@ plugins_init(void)
|
||||
GSList *curr = plugins;
|
||||
while (curr) {
|
||||
ProfPlugin *plugin = curr->data;
|
||||
plugin->init_func(plugin, PACKAGE_VERSION, PACKAGE_STATUS);
|
||||
plugin->init_func(plugin, PACKAGE_VERSION, PACKAGE_STATUS, NULL, NULL);
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
}
|
||||
@ -155,7 +155,13 @@ plugins_load(const char *const name)
|
||||
#endif
|
||||
if (plugin) {
|
||||
plugins = g_slist_append(plugins, plugin);
|
||||
plugin->init_func(plugin, PACKAGE_VERSION, PACKAGE_STATUS);
|
||||
if (jabber_get_connection_status() == JABBER_CONNECTED) {
|
||||
const char *account_name = jabber_get_account_name();
|
||||
const char *fulljid = jabber_get_fulljid();
|
||||
plugin->init_func(plugin, PACKAGE_VERSION, PACKAGE_STATUS, account_name, fulljid);
|
||||
} else {
|
||||
plugin->init_func(plugin, PACKAGE_VERSION, PACKAGE_STATUS, NULL, NULL);
|
||||
}
|
||||
log_info("Loaded plugin: %s", name);
|
||||
return TRUE;
|
||||
} else {
|
||||
|
@ -47,7 +47,7 @@ typedef struct prof_plugin_t {
|
||||
lang_t lang;
|
||||
void *module;
|
||||
void (*init_func)(struct prof_plugin_t* plugin, const char * const version,
|
||||
const char * const status);
|
||||
const char * const status, const char *const account_name, const char *const fulljid);
|
||||
|
||||
void (*on_start_func)(struct prof_plugin_t* plugin);
|
||||
void (*on_shutdown_func)(struct prof_plugin_t* plugin);
|
||||
|
@ -128,10 +128,11 @@ python_plugin_create(const char *const filename)
|
||||
}
|
||||
|
||||
void
|
||||
python_init_hook(ProfPlugin *plugin, const char *const version, const char *const status)
|
||||
python_init_hook(ProfPlugin *plugin, const char *const version, const char *const status, const char *const account_name,
|
||||
const char *const fulljid)
|
||||
{
|
||||
disable_python_threads();
|
||||
PyObject *p_args = Py_BuildValue("ss", version, status);
|
||||
PyObject *p_args = Py_BuildValue("ssss", version, status, account_name, fulljid);
|
||||
PyObject *p_function;
|
||||
|
||||
PyObject *p_module = plugin->module;
|
||||
|
@ -43,7 +43,8 @@ void python_check_error(void);
|
||||
void allow_python_threads();
|
||||
void disable_python_threads();
|
||||
|
||||
void python_init_hook(ProfPlugin *plugin, const char *const version, const char *const status);
|
||||
void python_init_hook(ProfPlugin *plugin, const char *const version, const char *const status,
|
||||
const char *const account_name, const char *const fulljid);
|
||||
void python_on_start_hook(ProfPlugin *plugin);
|
||||
void python_on_shutdown_hook(ProfPlugin *plugin);
|
||||
void python_on_connect_hook(ProfPlugin *plugin, const char *const account_name, const char *const fulljid);
|
||||
|
Loading…
Reference in New Issue
Block a user