- Timestamp:
- 2016-05-26T02:48:08Z (9 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)
- Location:
- protocols
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.