void qq_account_free(qq_account* ac) { //int i; //PurpleConnection* gc = purple_account_get_connection(ac->account); /*for(i=0;i<ac->opend_chat->len;i++){ purple_conversation_destroy(purple_find_chat(gc, i)); }*/ purple_log_free(ac->sys_log); lwqq_js_close(ac->js); //g_ptr_array_free(ac->opend_chat,1); s_free(ac->recent_group_name); s_free(ac->font.family); #if QQ_USE_FAST_INDEX g_hash_table_destroy(ac->fast_index.qqnum_index); g_hash_table_destroy(ac->fast_index.uin_index); #endif lwqq_client_free(ac->qq); g_free(ac); }
static void write_message(PurpleBuddy *buddy, const char *message) { PurpleConversation *conv; const char *alias = purple_buddy_get_alias(buddy); /* Acquire conversion */ conv = purple_find_conversation_with_account( PURPLE_CONV_TYPE_ANY, buddy->name, buddy->account); if (conv != NULL) { /* If conversation is open just place there the message using purple_conversation_write() */ purple_conversation_write(conv, alias, message, PURPLE_MESSAGE_SYSTEM, time(NULL)); } else { /* No conversation opened. Reopen last or create new */ if (ONLY_OPENED_CONVERSATIONS) return; /* Log file to write to */ PurpleLog *log = NULL; if (!try_to_append(buddy, message)) { if (DEBUG) printf(INTRO "Creating new log file for %s\n", buddy->name); log = purple_log_new(PURPLE_LOG_IM, buddy->name, buddy->account, NULL, time(NULL), NULL); if (!log) { printf(INTRO "Log creation for %s failed!\n", buddy->name); return; } purple_log_write(log, PURPLE_MESSAGE_SYSTEM, alias, time(NULL), message); purple_log_free(log); } } return; }