summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/common/hexchat-plugin.h10
-rw-r--r--src/common/plugin.c27
-rw-r--r--src/common/plugin.h6
-rw-r--r--src/version-script3
4 files changed, 38 insertions, 8 deletions
diff --git a/src/common/hexchat-plugin.h b/src/common/hexchat-plugin.h
index db2630f7..d706cf85 100644
--- a/src/common/hexchat-plugin.h
+++ b/src/common/hexchat-plugin.h
@@ -182,6 +182,9 @@ struct _hexchat_plugin
 		  void *userdata);
 	int (*hexchat_emit_print_attrs) (hexchat_plugin *ph, hexchat_event_attrs *attrs,
 									 const char *event_name, ...);
+	hexchat_event_attrs *(*hexchat_event_attrs_create) (hexchat_plugin *ph);
+	void (*hexchat_event_attrs_free) (hexchat_plugin *ph,
+									  hexchat_event_attrs *attrs);
 };
 #endif
 
@@ -194,6 +197,10 @@ hexchat_hook_command (hexchat_plugin *ph,
 		    const char *help_text,
 		    void *userdata);
 
+hexchat_event_attrs *hexchat_event_attrs_create (hexchat_plugin *ph);
+
+void hexchat_event_attrs_free (hexchat_plugin *ph, hexchat_event_attrs *attrs);
+
 hexchat_hook *
 hexchat_hook_server (hexchat_plugin *ph,
 		   const char *name,
@@ -201,7 +208,6 @@ hexchat_hook_server (hexchat_plugin *ph,
 		   int (*callback) (char *word[], char *word_eol[], void *user_data),
 		   void *userdata);
 
-
 hexchat_hook *
 hexchat_hook_server_attrs (hexchat_plugin *ph,
 		   const char *name,
@@ -389,6 +395,8 @@ hexchat_pluginpref_list (hexchat_plugin *ph,
 #define HEXCHAT_PLUGIN_HANDLE (ph)
 #endif
 #define hexchat_hook_command ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_command)
+#define hexchat_event_attrs_create ((HEXCHAT_PLUGIN_HANDLE)->hexchat_event_attrs_create)
+#define hexchat_event_attrs_free ((HEXCHAT_PLUGIN_HANDLE)->hexchat_event_attrs_free)
 #define hexchat_hook_server ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_server)
 #define hexchat_hook_server_attrs ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_server_attrs)
 #define hexchat_hook_print ((HEXCHAT_PLUGIN_HANDLE)->hexchat_hook_print)
diff --git a/src/common/plugin.c b/src/common/plugin.c
index 8fd6805b..6edc9926 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -296,9 +296,8 @@ plugin_add (session *sess, char *filename, void *handle, void *init_func,
 		pl->hexchat_hook_server_attrs = hexchat_hook_server_attrs;
 		pl->hexchat_hook_print_attrs = hexchat_hook_print_attrs;
 		pl->hexchat_emit_print_attrs = hexchat_emit_print_attrs;
-
-		/* incase new plugins are loaded on older HexChat */
-		pl->hexchat_dummy1 = hexchat_dummy;
+		pl->hexchat_event_attrs_create = hexchat_event_attrs_create;
+		pl->hexchat_event_attrs_free = hexchat_event_attrs_free;
 
 		/* run hexchat_plugin_init, if it returns 0, close the plugin */
 		if (((hexchat_init_func *)init_func) (pl, &pl->name, &pl->desc, &pl->version, arg) == 0)
@@ -620,8 +619,28 @@ plugin_emit_command (session *sess, char *name, char *word[], char *word_eol[])
 	return plugin_hook_run (sess, name, word, word_eol, NULL, HOOK_COMMAND);
 }
 
-/* got a server PRIVMSG, NOTICE, numeric etc... */
+hexchat_event_attrs *
+hexchat_event_attrs_create (hexchat_plugin *ph)
+{
+	hexchat_event_attrs *attrs;
+
+	attrs = malloc (sizeof (*attrs));
+
+	if (attrs == NULL)
+		return NULL;
+
+	attrs->server_time_utc = (time_t) 0;
 
+	return attrs;
+}
+
+void
+hexchat_event_attrs_free (hexchat_plugin *ph, hexchat_event_attrs *attrs)
+{
+	g_free (attrs);
+}
+
+/* got a server PRIVMSG, NOTICE, numeric etc... */
 int
 plugin_emit_server (session *sess, char *name, char *word[], char *word_eol[])
 {
diff --git a/src/common/plugin.h b/src/common/plugin.h
index 3cb97866..f75639e9 100644
--- a/src/common/plugin.h
+++ b/src/common/plugin.h
@@ -146,9 +146,9 @@ struct _hexchat_plugin
 		  void *userdata);
 	int (*hexchat_emit_print_attrs) (hexchat_plugin *ph, hexchat_event_attrs *attrs,
 									 const char *event_name, ...);
-
-	/* If you add a new function here you should remove the dummy function bellow. */
-	void *(*hexchat_dummy1) (hexchat_plugin *ph);
+	hexchat_event_attrs *(*hexchat_event_attrs_create) (hexchat_plugin *ph);
+	void (*hexchat_event_attrs_free) (hexchat_plugin *ph,
+									  hexchat_event_attrs *attrs);
 
 	/* PRIVATE FIELDS! */
 	void *handle;		/* from dlopen */
diff --git a/src/version-script b/src/version-script
index 0e442389..a7ed1495 100644
--- a/src/version-script
+++ b/src/version-script
@@ -1,6 +1,8 @@
 EXPORTED {
 	global:
 		hexchat_hook_command;
+		hexchat_event_attrs_create;
+		hexchat_event_attrs_free;
 		hexchat_hook_server;
 		hexchat_hook_server_attrs;
 		hexchat_hook_print;
@@ -27,6 +29,7 @@ EXPORTED {
 		hexchat_plugingui_add;
 		hexchat_plugingui_remove;
 		hexchat_emit_print;
+		hexchat_emit_print_attrs;
 		hexchat_list_time;
 		hexchat_gettext;
 		hexchat_send_modes;