int weechat_plugin_end (struct t_weechat_plugin *plugin) { /* make C compiler happy */ (void) plugin; rmodifier_config_write (); rmodifier_free_all (); weechat_list_free (rmodifier_hook_list); weechat_config_free (rmodifier_config_file); return WEECHAT_RC_OK; }
void script_buffer_display_detail_script (struct t_script_repo *script) { struct tm *tm; char str_time[1024]; char *labels[] = { N_("Script"), N_("Version"), N_("Version loaded"), N_("Author"), N_("License"), N_("Description"), N_("Tags"), N_("Status"), N_("Date added"), N_("Date updated"), N_("URL"), N_("MD5"), N_("Requires"), N_("Min WeeChat"), N_("Max WeeChat"), NULL }; int i, length, max_length, line; struct t_weelist *list; struct t_weelist_item *ptr_item; max_length = 0; for (i = 0; labels[i]; i++) { length = weechat_utf8_strlen_screen (_(labels[i])); if (length > max_length) max_length = length; } line = 0; weechat_printf_y (script_buffer, line + 1, "%s: %s%s%s.%s", script_buffer_detail_label (_(labels[line]), max_length), weechat_color (weechat_config_string (script_config_color_text_name)), script->name, weechat_color (weechat_config_string (script_config_color_text_extension)), script_extension[script->language]); line++; weechat_printf_y (script_buffer, line + 1, "%s: %s%s", script_buffer_detail_label (_(labels[line]), max_length), weechat_color (weechat_config_string (script_config_color_text_version)), script->version); line++; weechat_printf_y (script_buffer, line + 1, "%s: %s%s", script_buffer_detail_label (_(labels[line]), max_length), weechat_color (weechat_config_string (script_config_color_text_version_loaded)), (script->version_loaded) ? script->version_loaded : "-"); line++; weechat_printf_y (script_buffer, line + 1, "%s: %s <%s>", script_buffer_detail_label (_(labels[line]), max_length), script->author, script->mail); line++; weechat_printf_y (script_buffer, line + 1, "%s: %s", script_buffer_detail_label (_(labels[line]), max_length), script->license); line++; weechat_printf_y (script_buffer, line + 1, "%s: %s", script_buffer_detail_label (_(labels[line]), max_length), script->description); line++; weechat_printf_y (script_buffer, line + 1, "%s: %s", script_buffer_detail_label (_(labels[line]), max_length), script->tags); line++; if ((script->popularity == 0) && (script->status == 0)) { weechat_printf_y (script_buffer, line + 1, "%s: -", script_buffer_detail_label (_(labels[line]), max_length)); } else { weechat_printf_y (script_buffer, line + 1, "%s: %s%s (%s)", script_buffer_detail_label (_(labels[line]), max_length), script_repo_get_status_for_display (script, "*iaHrN", 1), weechat_color ("chat"), script_repo_get_status_desc_for_display (script, "*iaHrN")); } line++; tm = localtime (&script->date_added); strftime (str_time, sizeof (str_time), "%Y-%m-%d %H:%M:%S", tm); weechat_printf_y (script_buffer, line + 1, "%s: %s", script_buffer_detail_label (_(labels[line]), max_length), str_time); line++; tm = localtime (&script->date_updated); strftime (str_time, sizeof (str_time), "%Y-%m-%d %H:%M:%S", tm); weechat_printf_y (script_buffer, line + 1, "%s: %s", script_buffer_detail_label (_(labels[line]), max_length), str_time); line++; weechat_printf_y (script_buffer, line + 1, "%s: %s", script_buffer_detail_label (_(labels[line]), max_length), script->url); line++; weechat_printf_y (script_buffer, line + 1, "%s: %s", script_buffer_detail_label (_(labels[line]), max_length), script->md5sum); line++; weechat_printf_y (script_buffer, line + 1, "%s: %s", script_buffer_detail_label (_(labels[line]), max_length), (script->requirements) ? script->requirements : "-"); line++; weechat_printf_y (script_buffer, line + 1, "%s: %s", script_buffer_detail_label (_(labels[line]), max_length), (script->min_weechat) ? script->min_weechat : "-"); line++; weechat_printf_y (script_buffer, line + 1, "%s: %s", script_buffer_detail_label (_(labels[line]), max_length), (script->max_weechat) ? script->max_weechat : "-"); line++; if (script->status & SCRIPT_STATUS_RUNNING) { list = script_buffer_get_script_usage (script); if (list) { line++; weechat_printf_y (script_buffer, line + 1, _("Script has defined:")); i = 0; ptr_item = weechat_list_get (list, 0); while (ptr_item) { line++; weechat_printf_y (script_buffer, line + 1, " %s", weechat_list_string (ptr_item)); ptr_item = weechat_list_next (ptr_item); i++; } if (i == 0) { line++; weechat_printf_y (script_buffer, line + 1, " %s", _("(nothing)")); } line++; weechat_list_free (list); } } script_buffer_detail_script_last_line = line + 2; script_buffer_detail_script_line_diff = -1; }
int irc_completion_channels_cb (const void *pointer, void *data, const char *completion_item, struct t_gui_buffer *buffer, struct t_gui_completion *completion) { struct t_irc_server *ptr_server2; struct t_irc_channel *ptr_channel2; struct t_weelist *channels_current_server; int i; IRC_BUFFER_GET_SERVER_CHANNEL(buffer); /* make C compiler happy */ (void) pointer; (void) data; (void) completion_item; channels_current_server = weechat_list_new (); for (ptr_server2 = irc_servers; ptr_server2; ptr_server2 = ptr_server2->next_server) { for (ptr_channel2 = ptr_server2->channels; ptr_channel2; ptr_channel2 = ptr_channel2->next_channel) { if (ptr_channel2->type == IRC_CHANNEL_TYPE_CHANNEL) { if (ptr_server2 == ptr_server) { /* will be added later to completions */ weechat_list_add (channels_current_server, ptr_channel2->name, WEECHAT_LIST_POS_SORT, NULL); } else { weechat_hook_completion_list_add (completion, ptr_channel2->name, 0, WEECHAT_LIST_POS_SORT); } } } } /* add channels of current server first in list */ for (i = weechat_list_size (channels_current_server) - 1; i >= 0; i--) { weechat_hook_completion_list_add ( completion, weechat_list_string ( weechat_list_get (channels_current_server, i)), 0, WEECHAT_LIST_POS_BEGINNING); } weechat_list_free (channels_current_server); /* add current channel first in list */ if (ptr_channel) { weechat_hook_completion_list_add (completion, ptr_channel->name, 0, WEECHAT_LIST_POS_BEGINNING); } return WEECHAT_RC_OK; }