1 /* When writing a third-party plugin, do not include libpurple's internal.h
2 * included below. This file is for internal libpurple use only. We're including
3 * it here for our own convenience. */
6 /* This file includes all the libpurple headers */
9 /* include UI for pidgin_dialogs_about() */
10 #include "gtkplugin.h"
11 #include "gtkdialogs.h"
13 #define PURPLEINC_PLUGIN_ID "core-purpleinc"
16 echo_hi(PurpleConnection
*gc
)
18 /* this doesn't do much, just lets you know who we are :) */
19 pidgin_dialogs_about();
23 reverse(PurpleAccount
*account
, char **who
, char **message
,
24 PurpleConversation
*conv
, int *flags
)
26 /* this will drive you insane. whenever you receive a message,
27 * the text of the message (HTML and all) will be reversed. */
31 /* this check is necessary in case bad plugins do bad things */
32 if (message
== NULL
|| *message
== NULL
)
37 if (purple_strequal(*who
, purple_account_get_username(account
)))
40 for (i
= 0; i
< l
/2; i
++) {
42 (*message
)[i
] = (*message
)[l
- i
- 1];
43 (*message
)[l
- i
- 1] = tmp
;
51 PurpleAccount
*acct
= purple_buddy_get_account(who
);
52 PurpleIMConversation
*im
= purple_im_conversation_new(acct
,
53 purple_buddy_get_name(who
));
55 purple_conversation_send(PURPLE_CONVERSATION(im
), "Hello!");
62 static PidginPluginInfo
*
63 plugin_query(GError
**error
)
65 const gchar
* const authors
[] = {
66 "Eric Warmenhoven <eric@warmenhoven.org>",
70 return pidgin_plugin_info_new(
71 "id", PURPLEINC_PLUGIN_ID
,
72 "name", N_("Pidgin Demonstration Plugin"),
73 "version", DISPLAY_VERSION
,
74 "category", N_("Example"),
75 "summary", N_("An example plugin that does stuff - see the description."),
76 "description", N_("This is a really cool plugin that does a lot of stuff:\n"
77 "- It tells you who wrote the program when you log in\n"
78 "- It reverses all incoming text\n"
79 "- It sends a message to people on your list immediately"
80 " when they sign on"),
82 "website", PURPLE_WEBSITE
,
83 "abi-version", PURPLE_ABI_VERSION
,
89 plugin_load(PurplePlugin
*plugin
, GError
**error
)
91 /* this is for doing something fun when we sign on */
92 purple_signal_connect(purple_connections_get_handle(), "signed-on",
93 plugin
, PURPLE_CALLBACK(echo_hi
), NULL
);
95 /* this is for doing something fun when we get a message */
96 purple_signal_connect(purple_conversations_get_handle(), "receiving-im-msg",
97 plugin
, PURPLE_CALLBACK(reverse
), NULL
);
99 /* this is for doing something fun when a buddy comes online */
100 purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on",
101 plugin
, PURPLE_CALLBACK(bud
), NULL
);
107 plugin_unload(PurplePlugin
*plugin
, GError
**error
)
112 PURPLE_PLUGIN_INIT(purpleinc
, plugin_query
, plugin_load
, plugin_unload
);