--- a/listhandler/gen_xml_files.c Mon Sep 24 04:26:26 2007 -0400
+++ b/listhandler/gen_xml_files.c Wed Sep 26 13:23:32 2007 -0400
@@ -207,7 +207,7 @@
lh_generic_build_blist_tree(xmlnode *parent)
- /* root of tree group contact buddy */
+ /* root of tree group contact buddy */ PurpleBlistNode *root = buddies->root, *g = NULL, *c = NULL, *b = NULL;
xmlnode *group = NULL, *buddy = NULL;
PurpleBuddy *tmpbuddy = NULL;
--- a/listhandler/listhandler.c Mon Sep 24 04:26:26 2007 -0400
+++ b/listhandler/listhandler.c Wed Sep 26 13:23:32 2007 -0400
@@ -25,6 +25,7 @@
#include "aim_blt_files.h"
#include "alias_xml_files.h"
#include "gen_xml_files.h"
+#include "purple_blist_xml.h" PurplePlugin *listhandler = NULL; /* the request api prefers this for a plugin */
@@ -51,6 +52,10 @@
lh_generic_import_action_cb);
list = g_list_append(list, action);
+ action = purple_plugin_action_new(_("Import A blist.xml From libpurple"), + lh_pbx_import_action_cb); + list = g_list_append(list, action); action = purple_plugin_action_new(_("Export AIM Buddy List File"),
lh_aim_export_action_cb);
list = g_list_append(list, action);
--- a/listhandler/purple_blist_xml.c Mon Sep 24 04:26:26 2007 -0400
+++ b/listhandler/purple_blist_xml.c Wed Sep 26 13:23:32 2007 -0400
@@ -31,10 +31,10 @@
/* important stuff for adding the buddies back */
/* useful blistnode settings */
@@ -69,9 +69,6 @@
/* clean up the allocated memory returned by the xmlnode api */
@@ -97,10 +94,10 @@
lh_pbx_import_file_parse(const char *file)
- LhPbxInfo tmpinfo = NULL;
+ LhPbxInfo *tmpinfo = NULL; - xmlnode *root = NULL, blist = NULL, giter = NULL, citer = NULL, biter = NULL, siter = NULL;
+ xmlnode *root = NULL, *blist = NULL, *giter = NULL, *citer = NULL, *biter = NULL, *siter = NULL; /* grab the file contents, but bail out if there's an error */
if(!g_file_get_contents(file, &contents, &length, &error)) {
@@ -133,32 +130,28 @@
tmpinfo->prpl_id = xmlnode_get_attrib(biter, "proto");
for(; siter; siter = xmlnode_get_next_twin(siter)) {
- gchar *setting_name = NULL, *data = NULL;
+ const gchar *setting_name = NULL; setting_name = xmlnode_get_attrib(siter, "name");
data = xmlnode_get_data(siter);
- if(g_ascii_strcasecmp("signedon", setting_name)) {
+ if(g_ascii_strcasecmp("signedon", setting_name)) tmpinfo->signed_on = atoi(data);
- } else if(g_ascii_strcasecmp("signedoff", setting_name)) {
+ else if(g_ascii_strcasecmp("signedoff", setting_name)) tmpinfo->signed_off = atoi(data);
- } else if(g_ascii_strcasecmp("lastseen", setting_name)) {
+ else if(g_ascii_strcasecmp("lastseen", setting_name)) tmpinfo->lastseen = atoi(data);
- } else if(g_ascii_strcasecmp("last_seen", setting_name)) {
+ else if(g_ascii_strcasecmp("last_seen", setting_name)) tmpinfo->last_seen = atoi(data);
- } else if(g_ascii_strcasecmp("guifications-theme", setting_name)) {
+ else if(g_ascii_strcasecmp("guifications-theme", setting_name)) tmpinfo->gf_theme = data;
- } else if(g_ascii_strcasecmp("buddy_icon", setting_name)) {
+ else if(g_ascii_strcasecmp("buddy_icon", setting_name)) tmpinfo->icon_file = data;
- } else if(g_ascii_strcasecmp("lastsaid", setting_name)) {
+ else if(g_ascii_strcasecmp("lastsaid", setting_name)) tmpinfo->lastsaid = data;
- } else if(g_ascii_strcasecmp("notes", setting_name)) {
+ else if(g_ascii_strcasecmp("notes", setting_name))
infolist = g_list_prepend(infolist, tmpinfo);
@@ -176,17 +169,29 @@
lh_pbx_import_target_request(void)
+ LhPbxInfo *itmp = NULL; + for(; tmp; tmp = tmp->next) { + purple_debug_info("listhandler: import", "Buddy in infolist:\n\tScreenname: %s\n\tAlias: " + "%s\n\tGroup: %s\n\tAccount name: %s\n\tProtocol ID: %s\n\tSigned on/off: " + "%i/%i\n\tLast seens: %i/%i\n\tGuifications theme: %s\n\tIcon file: %s\n\t" + "Last said: %s\n\tBuddy Notes: %s\n\n\n", itmp->screenname, itmp->alias, + itmp->alias, itmp->group, itmp->account, itmp->prpl_id, itmp->signed_on, + itmp->signed_off, itmp->lastseen, itmp->last_seen, itmp->gf_theme, itmp->icon_file, + itmp->lastsaid, itmp->notes); lh_pbx_import_request_cb(void *user_data, const char *file)
purple_debug_info("listhandler: import", "In request callback\n");
- lh_pbx_file_parse(file);
+ lh_pbx_import_file_parse(file); lh_pbx_import_target_request();