gboolean plugin_done(void) { hooks_unregister_hook(FOLDER_ITEM_UPDATE_HOOKLIST, hook_f_item); hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST, hook_f); hooks_unregister_hook(MSGINFO_UPDATE_HOOKLIST, hook_m_info); hooks_unregister_hook(OFFLINE_SWITCH_HOOKLIST, hook_offline); hooks_unregister_hook(MAIN_WINDOW_CLOSE, hook_mw_close); hooks_unregister_hook(MAIN_WINDOW_GOT_ICONIFIED, hook_got_iconified); hooks_unregister_hook(ACCOUNT_LIST_CHANGED_HOOKLIST, hook_account); hooks_unregister_hook(THEME_CHANGED_HOOKLIST, hook_theme_changed); notify_save_config(); notify_gtk_done(); /* foldercheck cleanup */ notification_foldercheck_write_array(); notification_free_folder_specific_array(); #ifdef NOTIFICATION_BANNER notification_collected_msgs_free(banner_collected_msgs); banner_collected_msgs = NULL; notification_banner_destroy(); #endif #ifdef NOTIFICATION_LCDPROC notification_lcdproc_disconnect(); #endif #ifdef NOTIFICATION_TRAYICON notification_trayicon_destroy(); #endif #ifdef NOTIFICATION_INDICATOR notification_indicator_destroy(); #endif notification_core_free(); #ifdef HAVE_LIBNOTIFY if(notify_is_initted()) notify_uninit(); #endif #ifdef NOTIFICATION_HOTKEYS notification_hotkeys_unbind_all(); #endif notification_pixbuf_free_all(); debug_print("Notification plugin unloaded\n"); /* Returning FALSE here means that g_module_close() will not be called on the plugin. * This is necessary, as needed libraries are not designed to be unloaded. */ return FALSE; }
void notification_lcdproc_connect(void) { gint len, count; gchar buf[NOTIFICATION_LCDPROC_BUFFER_SIZE]; if(!notify_config.lcdproc_enabled) return; if(sock) notification_lcdproc_disconnect(); sock = sock_connect(notify_config.lcdproc_hostname, notify_config.lcdproc_port); /* * Quietly return when a connection fails; next attempt * will be made when some folder info has been changed. */ if(sock == NULL || sock->state == CONN_FAILED) { debug_print("Could not connect to LCDd\n"); if(sock && sock->state == CONN_FAILED) { sock_close(sock, TRUE); sock = NULL; } return; } else debug_print("Connected to LCDd\n"); sock_set_nonblocking_mode(sock, TRUE); /* Friendly people say "hello" first */ notification_sock_puts(sock, "hello"); /* FIXME: Ouch. Is this really the way to go? */ count = 50; len = 0; while((len <= 0) && (count-- >= 0)) { g_usleep(125000); len = sock_read(sock, buf, NOTIFICATION_LCDPROC_BUFFER_SIZE); } /* * This might not be a LCDProc server. * FIXME: check LCD size, LCDd version etc */ if (len <= 0) { debug_print("Notification plugin: Can't communicate with " "LCDd server! Are you sure that " "there is a LCDd server running on %s:%d?\n", notify_config.lcdproc_hostname, notify_config.lcdproc_port); notification_lcdproc_disconnect(); return; } notification_lcdproc_send("client_set -name \"{Claws-Mail}\""); notification_lcdproc_send("screen_add msg_counts"); notification_lcdproc_send("screen_set msg_counts -name {Claws-Mail Message Count}"); notification_lcdproc_send("widget_add msg_counts title title"); notification_lcdproc_send("widget_set msg_counts title {Claws-Mail}"); notification_lcdproc_send("widget_add msg_counts line1 string"); notification_lcdproc_send("widget_add msg_counts line2 string"); notification_lcdproc_send("widget_add msg_counts line3 string"); notification_update_msg_counts(NULL); }