From: Michael D. S. <ter...@co...> - 2005-05-31 05:34:24
|
Hello...I'm trying to migrate from Miranda-IM to gAIM, and I managed to export my entire database and import the history successfully, but, it turns out Miranda didn't properly add my buddy list, so the server's list is empty. Since I have 200+ AIM buddies, entering them manually would be a colossal waste of time. Accordingly, I'm trying to write a plugin for one-time use that will do it for me. However, it's, uh, not working. The text of the plugin: <begin> #include <stdio.h> #include <stdlib.h> #include "internal.h" #include "notify.h" #include "blist.h" #include "account.h" #include "debug.h" #include "plugin.h" #include "version.h" #include "connection.h" #include "server.h" #include "prpl.h" static gboolean plugin_load(GaimPlugin *plugin) { gaim_debug(GAIM_DEBUG_INFO, "importblist", "importblist loaded.\n"); //gaim_notify_message( plugin, GAIM_NOTIFY_MSG_INFO, "Import Buddy List!", "Import Buddy List works so far! =]", NULL, NULL, NULL ); FILE* buddiesIn = fopen( "/home/terralthra/buddylisttest.txt", "r" ); FILE* buddiesOut = fopen( "/home/terralthra/buddydump.txt", "w" ); GaimAccount* aimAccount = gaim_accounts_find( "TerrsOtherComp", "prpl-oscar" ); GaimConnection* aimConnection = gaim_account_get_connection( aimAccount ); while( TRUE ) { char c[100]; if( fgets(c, 100, buddiesIn ) == NULL ) { break; } char* buddy = strtok( c, "\n" ); GaimBuddy* tempBuddy; tempBuddy = gaim_buddy_new( aimAccount, buddy, NULL ); gaim_blist_add_buddy( tempBuddy, NULL, NULL, NULL ); serv_add_buddy( aimConnection, tempBuddy ); //TEH PROBLEM IS HERE fprintf( buddiesOut, "%s\n", buddy ); } fclose( buddiesIn ); fclose( buddiesOut ); return TRUE; } static gboolean plugin_unload(GaimPlugin *plugin) { gaim_debug(GAIM_DEBUG_INFO, "importblist", "importblist unloaded.\n"); return TRUE; } static GaimPluginInfo info = { GAIM_PLUGIN_MAGIC, GAIM_MAJOR_VERSION, GAIM_MINOR_VERSION, GAIM_PLUGIN_STANDARD, /**< type */ NULL, /**< ui_requirement */ 0, /**< flags */ NULL, /**< dependencies */ GAIM_PRIORITY_DEFAULT, /**< priority */ NULL, /**< id */ N_("ImportBuddyList"), /**< name */ VERSION, /**< version */ /** summary */ N_("Adds any directory in your logfile to blist"), /** description */ N_("Adds all log directories to blist"), "Michael D. Shannon <ter...@te...>", /**< author */ GAIM_WEBSITE, /**< homepage */ plugin_load, /**< load */ plugin_unload, /**< unload */ NULL, /**< destroy */ NULL, /**< ui_info */ NULL, /**< extra_info */ NULL, NULL }; static void init_plugin(GaimPlugin *plugin) { } GAIM_INIT_PLUGIN(importblist, init_plugin, info) <end> buddylist.txt is a simple text file consisting of every buddy's screen name, each on their own line. the buddydump is strictly for logging purposes. When loaded, this plugin works except for one thing...the 214 "Unknown Error while adding buddy" error windows. Given that the buddy list in question is, uh, empty, that's scarcely possible. Any suggestions? -Michael D. Shannon |