Changeset 7a9d968 for protocols/nogaim.c
- Timestamp:
- 2018-03-10T11:30:39Z (7 years ago)
- Children:
- 5447c59
- Parents:
- 3f44e43 (diff), 4a9c6b0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.c
r3f44e43 r7a9d968 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 … … 797 815 msg = ic->acc->flags & ACC_FLAG_AWAY_MESSAGE ? away : NULL; 798 816 away = imc_away_state_find(m, away, &msg) ? : 799 (imc_away_state_find(m, "away", &msg) ? : m->data);817 (imc_away_state_find(m, "away", NULL) ? : m->data); 800 818 } else if (ic->acc->flags & ACC_FLAG_STATUS_MESSAGE) { 801 819 away = NULL; … … 831 849 contains no data unless it adds something to what 832 850 we have in state already. */ 833 if ( strlen(m->data) == strlen(away)) {851 if (message && strlen(m->data) == strlen(away)) { 834 852 *message = NULL; 835 853 } … … 857 875 for (m = gcm; m; m = m->next) { 858 876 if (g_strcasecmp(imc_away_alias_list[i][j], m->data) == 0) { 859 if (!keep_message ) {877 if (!keep_message && message) { 860 878 *message = NULL; 861 879 }
Note: See TracChangeset
for help on using the changeset viewer.