summary refs log tree commit diff stats
path: root/src
AgeCommit message (Expand)Author
2013-05-11fix errorTingPing
2013-05-11serverlistgui cleanupTingPing
2013-05-11Merge pull request #582 from Repentinus/patch-1TingPing
2013-05-11CosmeticsBerke Viktor
2013-05-11Make logmask consistent with scrollback maskBerke Viktor
2013-05-11Remove some redundancyBerke Viktor
2013-05-11Also disable labels, not just entriesBerke Viktor
2013-05-11Nuke nickserv password field and some cosmeticsBerke Viktor
2013-05-11Get rid of this unnecessary bufferBerke Viktor
2013-05-11Skeleton for tabbed uiBerke Viktor
2013-05-11Reorganize the network listBerke Viktor
2013-05-10Replace various network options with universal login method optionBerke Viktor
2013-05-09Added support for marking nicks that are away in different colour when away_s...Repentinus
2013-05-09Add option to support away tracking regardless of channel sizeHeiki Ojasild
2013-05-09Now process_numeric() passes the right session context to text_emit() when anDiogo Sousa
2013-05-08stop using gconfTingPing
2013-05-08Fix server tab changing color when activeTingPing
2013-05-08Show hours for last seen in friends listTingPing
2013-05-07Have gui_input_icon depend on gui_input_nick in prefsTingPing
2013-05-06Clean up IRCNetTingPing
2013-05-04Replace g_strdup_printf with g_build_filename where possibleBerke Viktor
2013-05-03Merge branch 'py3k' of git://github.com/TingPing/hexchatTingPing
2013-05-03Add python3 pluginTingPing
2013-05-03commaTingPing
2013-05-03update gamesurge's default nickserv typeTingPing
2013-05-03Merge pull request #565 from bviktor/nickservtypeTingPing
2013-05-03Don't make assumptions about the function being calledBerke Viktor
2013-05-03Fix QuakeNet registrationBerke Viktor
2013-05-03Provide default NickServ types where necessaryBerke Viktor
2013-05-03Merge pull request #571 from amalmurali/masterTingPing
2013-05-03Line breaks and typofixBerke Viktor
2013-05-01Do save_config() on Channel List window min, max changesRichardHitt
2013-05-01Do save_config() on Search-window checkbox changeRichardHitt
2013-05-01Fix warning about g_type_init() in dbus/example.cRichardHitt
2013-05-01Save nicks when closing network listTingPing
2013-05-01Update textevents.inAmal
2013-04-30remove incorrect notice help infoTingPing
2013-04-28Remove away announceTingPing
2013-04-28Remove useless slashBerke Viktor
2013-04-28Make NickServ registration configurable per-networkBerke Viktor
2013-04-28Make /msg nickserv the default registration typeBerke Viktor
2013-04-28Get rid of some hardcoded network recognitionBerke Viktor
2013-04-28Don't autoload WMPA, it's dead in the waterBerke Viktor
2013-04-28Don't hardcode "plugins" as the subdirectory for plugins in manyChristoph J. Thompson
2013-04-28CosmeticsBerke Viktor
2013-04-28Add hints about the beep fileBerke Viktor
2013-04-28Rename Sound to Sounds and reorder Chatting pagesBerke Viktor
2013-04-28Eliminate compiler warningBerke Viktor
2013-04-28Store just the filename if the sound file comes from the default sound dirBerke Viktor
2013-04-28Fix spacingBerke Viktor
the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * * Claessens Xavier * xclaesse@gmail.com */ #include <config.h> #include <dbus/dbus-glib.h> #include <stdlib.h> #include "../marshal.c" #define DBUS_SERVICE "org.hexchat.service" #define DBUS_REMOTE "/org/hexchat/Remote" #define DBUS_REMOTE_CONNECTION_INTERFACE "org.hexchat.connection" #define DBUS_REMOTE_PLUGIN_INTERFACE "org.hexchat.plugin" guint command_id; guint server_id; static void write_error (char *message, GError **error) { if (error == NULL || *error == NULL) { return; } g_printerr ("%s: %s\n", message, (*error)->message); g_clear_error (error); } static void test_server_cb (DBusGProxy *proxy, char *word[], char *word_eol[], guint hook_id, guint context_id, gpointer user_data) { if (hook_id == server_id) { g_print ("message: %s\n", word_eol[0]); } } static void test_command_cb (DBusGProxy *proxy, char *word[], char *word_eol[], guint hook_id, guint context_id, gpointer user_data) { GError *error = NULL; if (hook_id == command_id) { if (!dbus_g_proxy_call (proxy, "Unhook", &error, G_TYPE_UINT, hook_id, G_TYPE_INVALID, G_TYPE_INVALID)) { write_error ("Failed to complete unhook", &error); } /* Now if you write "/test blah" again in the HexChat window * you'll get a "Unknown command" error message */ g_print ("test command received: %s\n", word_eol[1]); if (!dbus_g_proxy_call (proxy, "Print", &error, G_TYPE_STRING, "test command succeed", G_TYPE_INVALID, G_TYPE_INVALID)) { write_error ("Failed to complete Print", &error); } } } static void unload_cb (void) { g_print ("Good bye !\n"); exit (EXIT_SUCCESS); } int main (int argc, char **argv) { DBusGConnection *connection; DBusGProxy *remote_object; GMainLoop *mainloop; gchar *path; GError *error = NULL; #if ! GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); #endif connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); if (connection == NULL) { write_error ("Couldn't connect to session bus", &error); return EXIT_FAILURE; } remote_object = dbus_g_proxy_new_for_name (connection, DBUS_SERVICE, DBUS_REMOTE, DBUS_REMOTE_CONNECTION_INTERFACE); if (!dbus_g_proxy_call (remote_object, "Connect", &error, G_TYPE_STRING, argv[0], G_TYPE_STRING, "example", G_TYPE_STRING, "Example of a D-Bus client", G_TYPE_STRING, "1.0", G_TYPE_INVALID, G_TYPE_STRING, &path, G_TYPE_INVALID)) { write_error ("Failed to complete Connect", &error); return EXIT_FAILURE; } g_object_unref (remote_object); remote_object = dbus_g_proxy_new_for_name (connection, DBUS_SERVICE, path, DBUS_REMOTE_PLUGIN_INTERFACE); g_free (path); if (!dbus_g_proxy_call (remote_object, "HookCommand", &error, G_TYPE_STRING, "test", G_TYPE_INT, 0, G_TYPE_STRING, "Simple D-BUS example", G_TYPE_INT, 1, G_TYPE_INVALID, G_TYPE_UINT, &command_id, G_TYPE_INVALID)) { write_error ("Failed to complete HookCommand", &error); return EXIT_FAILURE; } g_print ("Command hook id=%d\n", command_id); if (!dbus_g_proxy_call (remote_object, "HookServer", &error, G_TYPE_STRING, "RAW LINE", G_TYPE_INT, 0, G_TYPE_INT, 0, G_TYPE_INVALID, G_TYPE_UINT, &server_id, G_TYPE_INVALID)) { write_error ("Failed to complete HookServer", &error); return EXIT_FAILURE; } g_print ("Server hook id=%d\n", server_id); dbus_g_object_register_marshaller ( _hexchat_marshal_VOID__POINTER_POINTER_UINT_UINT, G_TYPE_NONE, G_TYPE_STRV, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID); dbus_g_object_register_marshaller ( g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, G_TYPE_INVALID); dbus_g_proxy_add_signal (remote_object, "CommandSignal", G_TYPE_STRV, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID); dbus_g_proxy_connect_signal (remote_object, "CommandSignal", G_CALLBACK (test_command_cb), NULL, NULL); dbus_g_proxy_add_signal (remote_object, "ServerSignal", G_TYPE_STRV, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID); dbus_g_proxy_connect_signal (remote_object, "ServerSignal", G_CALLBACK (test_server_cb), NULL, NULL); dbus_g_proxy_add_signal (remote_object, "UnloadSignal", G_TYPE_INVALID); dbus_g_proxy_connect_signal (remote_object, "UnloadSignal", G_CALLBACK (unload_cb), NULL, NULL); /* Now you can write on the HexChat windows: "/test arg1 arg2 ..." */ mainloop = g_main_loop_new (NULL, FALSE); g_main_loop_run (mainloop); return EXIT_SUCCESS; }