about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/c_plugins.c10
-rw-r--r--src/plugins/c_plugins.h3
-rw-r--r--src/plugins/plugins.c10
-rw-r--r--src/plugins/plugins.h2
-rw-r--r--src/plugins/python_plugins.c5
-rw-r--r--src/plugins/python_plugins.h3
6 files changed, 22 insertions, 11 deletions
diff --git a/src/plugins/c_plugins.c b/src/plugins/c_plugins.c
index ff05791d..7fe10905 100644
--- a/src/plugins/c_plugins.c
+++ b/src/plugins/c_plugins.c
@@ -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
diff --git a/src/plugins/c_plugins.h b/src/plugins/c_plugins.h
index 1517ecb2..a62e302f 100644
--- a/src/plugins/c_plugins.h
+++ b/src/plugins/c_plugins.h
@@ -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);
diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c
index dfe19eb8..cb222a32 100644
--- a/src/plugins/plugins.c
+++ b/src/plugins/plugins.c
@@ -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 {
diff --git a/src/plugins/plugins.h b/src/plugins/plugins.h
index d69719f1..d59bc280 100644
--- a/src/plugins/plugins.h
+++ b/src/plugins/plugins.h
@@ -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);
diff --git a/src/plugins/python_plugins.c b/src/plugins/python_plugins.c
index be32983e..c927c7a9 100644
--- a/src/plugins/python_plugins.c
+++ b/src/plugins/python_plugins.c
@@ -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;
diff --git a/src/plugins/python_plugins.h b/src/plugins/python_plugins.h
index 6f81e2b8..71a62f1c 100644
--- a/src/plugins/python_plugins.h
+++ b/src/plugins/python_plugins.h
@@ -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);