| 46 } |
46 } |
| 47 |
47 |
| 48 static void |
48 static void |
| 49 bud(PurpleBuddy *who) |
49 bud(PurpleBuddy *who) |
| 50 { |
50 { |
| 51 PurpleAccount *acct = who->account; |
51 PurpleAccount *acct = purple_buddy_get_account(who); |
| 52 PurpleConversation *conv = purple_im_conversation_new(acct, who->name); |
52 PurpleIMConversation *im = purple_im_conversation_new(acct, |
| |
53 purple_buddy_get_name(who)); |
| 53 |
54 |
| 54 purple_im_conversation_send(PURPLE_CONV_IM(conv), "Hello!"); |
55 purple_conversation_send(PURPLE_CONVERSATION(im), "Hello!"); |
| 55 } |
56 } |
| 56 |
57 |
| 57 /* |
58 /* |
| 58 * EXPORTED FUNCTIONS |
59 * EXPORTED FUNCTIONS |
| 59 */ |
60 */ |
| 60 |
61 |
| |
62 static PidginPluginInfo * |
| |
63 plugin_query(GError **error) |
| |
64 { |
| |
65 const gchar * const authors[] = { |
| |
66 "Eric Warmenhoven <eric@warmenhoven.org>", |
| |
67 NULL |
| |
68 }; |
| |
69 |
| |
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"), |
| |
81 "authors", authors, |
| |
82 "website", PURPLE_WEBSITE, |
| |
83 "abi-version", PURPLE_ABI_VERSION, |
| |
84 NULL |
| |
85 ); |
| |
86 } |
| |
87 |
| 61 static gboolean |
88 static gboolean |
| 62 plugin_load(PurplePlugin *plugin) |
89 plugin_load(PurplePlugin *plugin, GError **error) |
| 63 { |
90 { |
| 64 /* this is for doing something fun when we sign on */ |
91 /* this is for doing something fun when we sign on */ |
| 65 purple_signal_connect(purple_connections_get_handle(), "signed-on", |
92 purple_signal_connect(purple_connections_get_handle(), "signed-on", |
| 66 plugin, PURPLE_CALLBACK(echo_hi), NULL); |
93 plugin, PURPLE_CALLBACK(echo_hi), NULL); |
| 67 |
94 |
| 74 plugin, PURPLE_CALLBACK(bud), NULL); |
101 plugin, PURPLE_CALLBACK(bud), NULL); |
| 75 |
102 |
| 76 return TRUE; |
103 return TRUE; |
| 77 } |
104 } |
| 78 |
105 |
| 79 static PurplePluginInfo info = |
106 static gboolean |
| |
107 plugin_unload(PurplePlugin *plugin, GError **error) |
| 80 { |
108 { |
| 81 PURPLE_PLUGIN_MAGIC, |
109 return TRUE; |
| 82 PURPLE_MAJOR_VERSION, |
|
| 83 PURPLE_MINOR_VERSION, |
|
| 84 PURPLE_PLUGIN_STANDARD, /**< type */ |
|
| 85 NULL, /**< ui_requirement */ |
|
| 86 0, /**< flags */ |
|
| 87 NULL, /**< dependencies */ |
|
| 88 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
|
| 89 |
|
| 90 PURPLEINC_PLUGIN_ID, /**< id */ |
|
| 91 N_("Pidgin Demonstration Plugin"), /**< name */ |
|
| 92 DISPLAY_VERSION, /**< version */ |
|
| 93 /** summary */ |
|
| 94 N_("An example plugin that does stuff - see the description."), |
|
| 95 /** description */ |
|
| 96 N_("This is a really cool plugin that does a lot of stuff:\n" |
|
| 97 "- It tells you who wrote the program when you log in\n" |
|
| 98 "- It reverses all incoming text\n" |
|
| 99 "- It sends a message to people on your list immediately" |
|
| 100 " when they sign on"), |
|
| 101 "Eric Warmenhoven <eric@warmenhoven.org>", /**< author */ |
|
| 102 PURPLE_WEBSITE, /**< homepage */ |
|
| 103 |
|
| 104 plugin_load, /**< load */ |
|
| 105 NULL, /**< unload */ |
|
| 106 NULL, /**< destroy */ |
|
| 107 |
|
| 108 NULL, /**< ui_info */ |
|
| 109 NULL, /**< extra_info */ |
|
| 110 NULL, /**< prefs_info */ |
|
| 111 NULL, /**< actions */ |
|
| 112 /* padding */ |
|
| 113 NULL, |
|
| 114 NULL, |
|
| 115 NULL, |
|
| 116 NULL |
|
| 117 }; |
|
| 118 |
|
| 119 static void |
|
| 120 init_plugin(PurplePlugin *plugin) |
|
| 121 { |
|
| 122 } |
110 } |
| 123 |
111 |
| 124 PURPLE_INIT_PLUGIN(purpleinc, init_plugin, info) |
112 PURPLE_PLUGIN_INIT(purpleinc, plugin_query, plugin_load, plugin_unload); |