Changes in protocols/nogaim.c [5a8afc3:eb73d05]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.c
r5a8afc3 reb73d05 50 50 } 51 51 52 /* semi-private */ 53 gboolean plugin_info_validate(struct plugin_info *info, const char *path) 54 { 55 GList *l; 56 gboolean loaded = FALSE; 57 58 if (!path) { 59 path = "(null)"; 60 } 61 62 if (info->abiver != BITLBEE_ABI_VERSION_CODE) { 63 log_message(LOGLVL_ERROR, 64 "`%s' uses ABI %u but %u is required\n", 65 path, info->abiver, 66 BITLBEE_ABI_VERSION_CODE); 67 return FALSE; 68 } 69 70 if (!info->name || !info->version) { 71 log_message(LOGLVL_ERROR, 72 "Name or version missing from the " 73 "plugin info in `%s'\n", path); 74 return FALSE; 75 } 76 77 for (l = plugins; l; l = l->next) { 78 struct plugin_info *i = l->data; 79 80 if (g_strcasecmp(i->name, info->name) == 0) { 81 loaded = TRUE; 82 break; 83 } 84 } 85 86 if (loaded) { 87 log_message(LOGLVL_WARNING, 88 "%s plugin already loaded\n", 89 info->name); 90 return FALSE; 91 } 92 93 return TRUE; 94 } 95 96 /* semi-private */ 97 gboolean plugin_info_add(struct plugin_info *info) 98 { 99 plugins = g_list_insert_sorted_with_data(plugins, info, pluginscmp, NULL); 100 return TRUE; 101 } 102 52 103 gboolean load_plugin(char *path) 53 104 { 54 GList *l; 55 struct plugin_info *i; 56 struct plugin_info *info; 105 struct plugin_info *info = NULL; 57 106 struct plugin_info * (*info_function) (void) = NULL; 58 107 void (*init_function) (void); 59 108 60 109 GModule *mod = g_module_open(path, G_MODULE_BIND_LAZY); 61 gboolean loaded = FALSE;62 110 63 111 if (!mod) { … … 69 117 info = info_function(); 70 118 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); 119 if (!plugin_info_validate(info, path)) { 101 120 g_module_close(mod); 102 121 return FALSE; … … 113 132 114 133 if (info_function) { 115 plugins = g_list_insert_sorted_with_data(plugins, info, 116 pluginscmp, NULL); 134 plugin_info_add(info); 117 135 } 118 136 … … 750 768 msg = ic->acc->flags & ACC_FLAG_AWAY_MESSAGE ? away : NULL; 751 769 away = imc_away_state_find(m, away, &msg) ? : 752 (imc_away_state_find(m, "away", &msg) ? : m->data);770 (imc_away_state_find(m, "away", NULL) ? : m->data); 753 771 } else if (ic->acc->flags & ACC_FLAG_STATUS_MESSAGE) { 754 772 away = NULL; … … 784 802 contains no data unless it adds something to what 785 803 we have in state already. */ 786 if ( strlen(m->data) == strlen(away)) {804 if (message && strlen(m->data) == strlen(away)) { 787 805 *message = NULL; 788 806 } … … 810 828 for (m = gcm; m; m = m->next) { 811 829 if (g_strcasecmp(imc_away_alias_list[i][j], m->data) == 0) { 812 if (!keep_message ) {830 if (!keep_message && message) { 813 831 *message = NULL; 814 832 }
Note: See TracChangeset
for help on using the changeset viewer.