#include <libpurple/account.h>
const char *purple_account_get_alias(const PurpleAccount *account);
/* Signal callback handling routing */ void received_im_msg_cb (DBusGProxy *purple_proxy, int account_id, const char *sender, const char *message, int conv_id, unsigned int flags, gpointer user_data) { /* need to inlcude "account.h" for following functions */ const PurpleAccount *account; const char *alias; const char *icon_path; const char *protocol; // PurpleAccount *purple_accounts_find_any(const char *name, const char *protocol); // PurpleAccount *purple_accounts_find_connected(const char *name, const char *protocol); account = purple_accounts_find(sender, NULL); /* get the alias */ alias = purple_account_get_alias(account); /* get the icon path */ icon_path = purple_account_get_buddy_icon_path(account); /* get the protocol name */ protocol = purple_account_get_protocol_name(account); g_print("Account %d receives msg \"%s\" from %s\n", account_id, message, sender); g_print("Alias %s, Path %s, Protocol %s", alias, icon_path, protocol); }
sudo gcc -MMD -Wall -ggdb -O `pkg-config --cflags dbus-1 glib-2.0 dbus-glib-1` `pkg-config --libs dbus-1 glib-2.0 dbus-glib-1` marshal.c pidginnotifyd.c -o pidginnotifyd
/tmp/ccVoXEPd.o: In function `received_im_msg_cb': /home/b666m/pidgin/pidginnotifyd.c:37: undefined reference to `purple_accounts_find' /home/b666m/pidgin/pidginnotifyd.c:40: undefined reference to `purple_account_get_alias' /home/b666m/pidgin/pidginnotifyd.c:42: undefined reference to `purple_account_get_buddy_icon_path' /home/b666m/pidgin/pidginnotifyd.c:44: undefined reference to `purple_account_get_protocol_name' collect2: ld returned 1 exit status
sudo gcc -MMD -Wall -ggdb -O `pkg-config --cflags dbus-1 glib-2.0 dbus-glib-1 pidgin` `pkg-config --libs dbus-1 glib-2.0 dbus-glib-1 pidgin` marshal.c pidginnotifyd.c -o pidginnotifyd