Changeset d28fe1c4
- Timestamp:
- 2016-05-26T02:48:08Z (8 years ago)
- Branches:
- master
- Children:
- 808825e
- Parents:
- 0e48e54
- git-author:
- jgeboski <jgeboski@…> (15-05-16 18:17:34)
- git-committer:
- jgeboski <jgeboski@…> (26-05-16 02:48:08)
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
bitlbee.h
r0e48e54 rd28fe1c4 40 40 #define BITLBEE_VER(a, b, c) (((a) << 16) + ((b) << 8) + (c)) 41 41 #define BITLBEE_VERSION_CODE BITLBEE_VER(3, 4, 2) 42 #define BITLBEE_ABI_VERSION_CODE 1 42 43 43 44 #define MAX_STRING 511 -
doc/user-guide/commands.xml
r0e48e54 rd28fe1c4 1835 1835 </bitlbee-command> 1836 1836 1837 <bitlbee-command name="plugins"> 1838 <short-description>List all the external plugins</short-description> 1839 <syntax>plugins</syntax> 1840 1841 <description> 1842 <para> 1843 This gives you a list of all the external plugins. 1844 </para> 1845 </description> 1846 1847 </bitlbee-command> 1848 1837 1849 <bitlbee-command name="qlist"> 1838 1850 <short-description>List all the unanswered questions root asked</short-description> -
otr.c
r0e48e54 rd28fe1c4 267 267 register_irc_plugin(&otr_plugin); 268 268 } 269 270 #ifndef OTR_BI 271 struct plugin_info *init_plugin_info(void) 272 { 273 static struct plugin_info info = { 274 BITLBEE_ABI_VERSION_CODE, 275 "otr", 276 BITLBEE_VERSION, 277 "Off-the-Record communication", 278 NULL, 279 NULL 280 }; 281 282 return &info; 283 } 284 #endif 269 285 270 286 gboolean otr_irc_new(irc_t *irc) -
protocols/nogaim.c
r0e48e54 rd28fe1c4 40 40 41 41 #ifdef WITH_PLUGINS 42 GList *plugins = NULL; 43 44 static gint pluginscmp(gconstpointer a, gconstpointer b, gpointer data) 45 { 46 const struct plugin_info *ia = a; 47 const struct plugin_info *ib = b; 48 49 return g_strcasecmp(ia->name, ib->name); 50 } 51 42 52 gboolean load_plugin(char *path) 43 53 { 54 GList *l; 55 struct plugin_info *i; 56 struct plugin_info *info; 57 struct plugin_info * (*info_function) (void) = NULL; 44 58 void (*init_function) (void); 45 59 46 60 GModule *mod = g_module_open(path, G_MODULE_BIND_LAZY); 61 gboolean loaded = FALSE; 47 62 48 63 if (!mod) { … … 51 66 } 52 67 68 if (g_module_symbol(mod, "init_plugin_info", (gpointer *) &info_function)) { 69 info = info_function(); 70 71 if (info->abiver != BITLBEE_ABI_VERSION_CODE) { 72 log_message(LOGLVL_ERROR, 73 "`%s' uses ABI %u but %u is required\n", 74 path, info->abiver, 75 BITLBEE_ABI_VERSION_CODE); 76 g_module_close(mod); 77 return FALSE; 78 } 79 80 if (!info->name || !info->version) { 81 log_message(LOGLVL_ERROR, 82 "Name or version missing from the " 83 "plugin info in `%s'\n", path); 84 g_module_close(mod); 85 return FALSE; 86 } 87 88 for (l = plugins; l; l = l->next) { 89 i = l->data; 90 91 if (g_strcasecmp(i->name, info->name) == 0) { 92 loaded = TRUE; 93 break; 94 } 95 } 96 97 if (loaded) { 98 log_message(LOGLVL_WARNING, 99 "%s plugin already loaded\n", 100 info->name); 101 g_module_close(mod); 102 return FALSE; 103 } 104 } else { 105 log_message(LOGLVL_WARNING, "Can't find function `init_plugin_info' in `%s'\n", path); 106 } 107 53 108 if (!g_module_symbol(mod, "init_plugin", (gpointer *) &init_function)) { 54 109 log_message(LOGLVL_WARNING, "Can't find function `init_plugin' in `%s'\n", path); 110 g_module_close(mod); 55 111 return FALSE; 56 112 } 57 113 114 if (info_function) { 115 plugins = g_list_insert_sorted_with_data(plugins, info, 116 pluginscmp, NULL); 117 } 118 58 119 init_function(); 59 60 120 return TRUE; 61 121 } … … 86 146 g_dir_close(dir); 87 147 } 148 } 149 150 GList *get_plugins() 151 { 152 return plugins; 88 153 } 89 154 #endif -
protocols/nogaim.h
r0e48e54 rd28fe1c4 271 271 }; 272 272 273 struct plugin_info 274 { 275 guint abiver; 276 const char *name; 277 const char *version; 278 const char *description; 279 const char *author; 280 const char *url; 281 }; 282 283 #ifdef WITH_PLUGINS 284 G_MODULE_EXPORT GList *get_plugins(); 285 #endif 286 273 287 /* im_api core stuff. */ 274 288 void nogaim_init(); -
protocols/skype/skype.c
r0e48e54 rd28fe1c4 1763 1763 register_protocol(ret); 1764 1764 } 1765 1766 struct plugin_info *init_plugin_info(void) 1767 { 1768 static struct plugin_info info = { 1769 BITLBEE_ABI_VERSION_CODE, 1770 "skype", 1771 BITLBEE_VERSION, 1772 "Skype protocol plugin", 1773 NULL, 1774 NULL 1775 }; 1776 1777 return &info; 1778 } -
root_commands.c
r0e48e54 rd28fe1c4 1106 1106 } 1107 1107 } 1108 1109 #ifdef WITH_PLUGINS 1110 static void cmd_plugins(irc_t *irc, char **cmd) 1111 { 1112 GList *l; 1113 struct plugin_info *info; 1114 1115 for (l = get_plugins(); l; l = l->next) { 1116 info = l->data; 1117 irc_rootmsg(irc, "%s:", info->name); 1118 irc_rootmsg(irc, " Version: %s", info->version); 1119 1120 if (info->description) { 1121 irc_rootmsg(irc, " Description: %s", info->description); 1122 } 1123 1124 if (info->author) { 1125 irc_rootmsg(irc, " Author: %s", info->author); 1126 } 1127 1128 if (info->url) { 1129 irc_rootmsg(irc, " URL: %s", info->url); 1130 } 1131 1132 if (l->next) { 1133 irc_rootmsg(irc, ""); 1134 } 1135 } 1136 } 1137 #endif 1108 1138 1109 1139 static void cmd_qlist(irc_t *irc, char **cmd) … … 1358 1388 { "nick", 1, cmd_nick, 0 }, 1359 1389 { "no", 0, cmd_yesno, 0 }, 1390 #ifdef WITH_PLUGINS 1391 { "plugins", 0, cmd_plugins, 0 }, 1392 #endif 1360 1393 { "qlist", 0, cmd_qlist, 0 }, 1361 1394 { "register", 0, cmd_register, 0 },
Note: See TracChangeset
for help on using the changeset viewer.