changeset 287:4a7f4ba199cc

- version bump to 0.8.3 - rewrite signed_on_cb()
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 03 Feb 2009 19:59:29 +0900
parents 6d0bb66fedc7
children 32ce4374dc8c
files configure.ac main.c twitter_api.c
diffstat 3 files changed, 27 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Wed Jan 28 23:17:40 2009 +0900
+++ b/configure.ac	Tue Feb 03 19:59:29 2009 +0900
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT(pidgin-twitter, 0.8.2, yaz@honeyplanet.jp)
+AC_INIT(pidgin-twitter, 0.8.3, yaz@honeyplanet.jp)
 AC_CONFIG_SRCDIR([main.c])
 
 # Checks for programs.
--- a/main.c	Wed Jan 28 23:17:40 2009 +0900
+++ b/main.c	Tue Feb 03 19:59:29 2009 +0900
@@ -1275,7 +1275,7 @@
     PURPLE_PRIORITY_DEFAULT,    /**< priority	*/
     PLUGIN_ID,                  /**< id     */
     "Pidgin-Twitter",           /**< name	*/
-    "0.8.2",                    /**< version	*/
+    "0.8.3d1",                    /**< version	*/
     "provides useful features for twitter", /**  summary	*/
     "provides useful features for twitter", /**  desc	*/
     "Yoshiki Yazawa, mikanbako, \nKonosuke Watanabe, IWATA Ray, \nmojin, umq, \nthe pidging-twitter team",     /**< author	*/
--- a/twitter_api.c	Wed Jan 28 23:17:40 2009 +0900
+++ b/twitter_api.c	Tue Feb 03 19:59:29 2009 +0900
@@ -523,51 +523,33 @@
 void
 signed_on_cb(PurpleConnection *gc)
 {
-    PurpleBuddyList *list = purple_get_blist();
-	PurpleBlistNode *gnode, *cnode, *bnode;
-	PurpleBuddy *b;
+    PurpleAccount *account;
+    PurpleBuddy *buddy;
+    PurpleConversation *gconv;
+    const char name[] = "twitter@twitter.com";
 
-    twitter_debug("called\n");
-
-    if(!purple_prefs_get_bool(OPT_API_BASE_POST))
-        return;
-
-    if (!list)
+    if(!purple_prefs_get_bool(OPT_API_BASE_POST)) {
+        twitter_debug("per prefs");
         return;
-
-    twitter_debug("scan list\n");
-
-	for (gnode = list->root; gnode; gnode = gnode->next) {
-		if(!PURPLE_BLIST_NODE_IS_GROUP(gnode))
-			continue;
-
-        for(cnode = gnode->child; cnode; cnode = cnode->next) {
-
-			if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
-				continue;
+    }
 
-			for(bnode = cnode->child; bnode; bnode = bnode->next) {
-				if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
-					continue;
-
-				b = (PurpleBuddy *)bnode;
+    account = purple_connection_get_account(gc);
+    if(!account) {
+        twitter_debug("no account");
+        return;
+    }
 
-				if(!PURPLE_BUDDY_IS_ONLINE(b)) {
-                    const char *name;
-                    PurpleAccount *account;
-                    name = purple_buddy_get_name(b);
-                    account = purple_buddy_get_account(b);
-                    if (is_twitter_account(account, name)) {
-                        PurpleConversation *gconv;
-                        gconv = purple_find_conversation_with_account(
-                            PURPLE_CONV_TYPE_IM, name, account);
-                        if (!gconv) {
-                            gconv = purple_conversation_new(
-                                PURPLE_CONV_TYPE_IM, account, name);
-                        }
-                    }
-                }
-			}
-		}
-	}
+    buddy = purple_find_buddy(account, name);
+    if(!buddy) {
+        twitter_debug("no buddy");
+        return;
+    }
+
+    gconv = purple_find_conversation_with_account(
+        PURPLE_CONV_TYPE_IM, name, account);
+    if(!gconv) {
+        gconv = purple_conversation_new(
+            PURPLE_CONV_TYPE_IM, account, name);
+        twitter_debug("new conv");
+    }
 }