changeset 110:8b98a26f44ce

made screen name for each service configurable.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 15 Jul 2008 15:07:23 +0900
parents 1fc8b74d96db
children 799b28f181f8
files pidgin-twitter.c pidgin-twitter.h
diffstat 2 files changed, 53 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin-twitter.c	Tue Jul 15 14:09:55 2008 +0900
+++ b/pidgin-twitter.c	Tue Jul 15 15:07:23 2008 +0900
@@ -413,8 +413,9 @@
 
     twitter_message_t *tm;
 
-    const char *screen_name = purple_prefs_get_string(OPT_SCREEN_NAME);
-    const char *password = purple_prefs_get_string(OPT_PASSWORD);
+    const char *screen_name =
+        purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER);
+    const char *password = purple_prefs_get_string(OPT_PASSWORD_TWITTER);
 
     twitter_debug("tm.account: %s\n",
                   purple_account_get_username(account));
@@ -659,7 +660,20 @@
     /* Add screen_name if the current message is posted by owner */
     if (flags & PURPLE_MESSAGE_SEND) {
         gchar *m = NULL;
-        const char *screen_name = purple_prefs_get_string(OPT_SCREEN_NAME);
+        const char *screen_name;
+
+        switch(service) {
+        case twitter_service:
+            screen_name = purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER);
+            break;
+        case wassr_service:
+            screen_name = purple_prefs_get_string(OPT_SCREEN_NAME_WASSR);
+            break;
+        case identica_service:
+            screen_name = purple_prefs_get_string(OPT_SCREEN_NAME_IDENTICA);
+            break;
+        }
+
         if (screen_name) {
             m = g_strdup_printf("%s: %s", screen_name, *buffer);
             g_free(*buffer);
@@ -1975,27 +1989,34 @@
     PurplePluginPrefFrame *frame = purple_plugin_pref_frame_new();
 
     /************************/
-    /* user config heading */
+    /* screen name heading */
     /************************/
-    pref = purple_plugin_pref_new_with_label("User Account");
+    pref = purple_plugin_pref_new_with_label("Screen Name");
+    purple_plugin_pref_frame_add(frame, pref);
+
+    /* twitter */
+    pref =
+        purple_plugin_pref_new_with_name_and_label(OPT_SCREEN_NAME_TWITTER,
+                                                      "twitter");
     purple_plugin_pref_frame_add(frame, pref);
 
-    /* screenname configurations */
-    pref = purple_plugin_pref_new_with_name_and_label(OPT_SCREEN_NAME,
-                                                      "Screen Name");
+    /* wassr */
+    pref =
+        purple_plugin_pref_new_with_name_and_label(OPT_SCREEN_NAME_WASSR,
+                                                   "wassr");
     purple_plugin_pref_frame_add(frame, pref);
 
-    pref = purple_plugin_pref_new_with_name_and_label(OPT_PASSWORD,
-                                                      "Password");
-    purple_plugin_pref_set_masked(pref, TRUE);
-
+    /* identica */
+    pref =
+        purple_plugin_pref_new_with_name_and_label(OPT_SCREEN_NAME_IDENTICA,
+                                                   "identi.ca");
     purple_plugin_pref_frame_add(frame, pref);
 
 
     /************************/
     /* translation heading */
     /************************/
-    pref = purple_plugin_pref_new_with_label("Translation Configurations");
+    pref = purple_plugin_pref_new_with_label("Translation");
     purple_plugin_pref_frame_add(frame, pref);
 
     /* translation settings */
@@ -2015,7 +2036,7 @@
     /***********************/
     /* GUI config heading */
     /***********************/
-    pref = purple_plugin_pref_new_with_label("GUI Configurations");
+    pref = purple_plugin_pref_new_with_label("GUI");
     purple_plugin_pref_frame_add(frame, pref);
 
     /* show icon */
@@ -2044,7 +2065,7 @@
     /****************************/
     /* advanced config heading */
     /****************************/
-    pref = purple_plugin_pref_new_with_label("Advanced Configurations");
+    pref = purple_plugin_pref_new_with_label("Advanced");
     purple_plugin_pref_frame_add(frame, pref);
 
     /* escape pseudo command setting */
@@ -2067,7 +2088,7 @@
     /******************/
     /* sound heading */
     /******************/
-    pref = purple_plugin_pref_new_with_label("Sound Configurations");
+    pref = purple_plugin_pref_new_with_label("Sound");
     purple_plugin_pref_frame_add(frame, pref);
 
     /* sound settings for recipient */
@@ -2132,14 +2153,19 @@
     /****************/
     /* API heading */
     /****************/
-    pref = purple_plugin_pref_new_with_label("API Based Post Configuration");
+    pref = purple_plugin_pref_new_with_label("API Based Post");
     purple_plugin_pref_frame_add(frame, pref);
 
     /* post configuration */
-    pref = purple_plugin_pref_new_with_name_and_label(OPT_API_BASE_POST, 
+    pref = purple_plugin_pref_new_with_name_and_label(OPT_API_BASE_POST,
                                              "Post Status to Twitter via API");
     purple_plugin_pref_frame_add(frame, pref);
 
+    /* password */
+    pref = purple_plugin_pref_new_with_name_and_label(OPT_PASSWORD_TWITTER,
+                                                      "Password");
+    purple_plugin_pref_set_masked(pref, TRUE);
+    purple_plugin_pref_frame_add(frame, pref);
 
     return frame;
 }
@@ -2159,7 +2185,7 @@
     PURPLE_PRIORITY_DEFAULT,    /**< priority	*/
     PLUGIN_ID,                  /**< id		*/
     "Pidgin-Twitter",           /**< name	*/
-    "0.7.0 alpha2d1",                    /**< version	*/
+    "0.7.0",                    /**< version	*/
     "provides useful features for twitter", /**  summary	*/
     "provides useful features for twitter", /**  desc	*/
     "Yoshiki Yazawa, mikanbako, \nKonosuke Watanabe, IWATA Ray, mojin, \nthe pidging-twitter team",     /**< author	*/
@@ -2204,10 +2230,12 @@
     purple_prefs_add_bool(OPT_SHOW_ICON, TRUE);
 
     purple_prefs_add_bool(OPT_API_BASE_POST, FALSE);
-    purple_prefs_add_string(OPT_SCREEN_NAME, EMPTY);
-    purple_prefs_add_string(OPT_PASSWORD, EMPTY);
+    purple_prefs_add_string(OPT_SCREEN_NAME_TWITTER, EMPTY);
+    purple_prefs_add_string(OPT_PASSWORD_TWITTER, EMPTY);
 
     purple_prefs_add_int(OPT_ICON_SIZE, 48);
+    purple_prefs_add_string(OPT_SCREEN_NAME_WASSR, EMPTY);
+    purple_prefs_add_string(OPT_SCREEN_NAME_IDENTICA, EMPTY);
 }
 
 PURPLE_INIT_PLUGIN(pidgin_twitter, init_plugin, info)
--- a/pidgin-twitter.h	Tue Jul 15 14:09:55 2008 +0900
+++ b/pidgin-twitter.h	Tue Jul 15 15:07:23 2008 +0900
@@ -49,8 +49,10 @@
 #define OPT_PREVENT_NOTIFICATION OPT_PIDGINTWITTER "/prevent_notification"
 #define OPT_ICON_DIR            OPT_PIDGINTWITTER "/icon_dir"
 #define OPT_API_BASE_POST       OPT_PIDGINTWITTER "/api_base_post"
-#define OPT_SCREEN_NAME         OPT_PIDGINTWITTER "/screen_name"
-#define OPT_PASSWORD            OPT_PIDGINTWITTER "/password"
+#define OPT_SCREEN_NAME_TWITTER OPT_PIDGINTWITTER "/screen_name_twitter"
+#define OPT_SCREEN_NAME_WASSR   OPT_PIDGINTWITTER "/screen_name_wassr"
+#define OPT_SCREEN_NAME_IDENTICA OPT_PIDGINTWITTER "/screen_name_identica"
+#define OPT_PASSWORD_TWITTER    OPT_PIDGINTWITTER "/password_twitter"
 #define OPT_SHOW_ICON           OPT_PIDGINTWITTER "/show_icon"
 #define OPT_ICON_SIZE           OPT_PIDGINTWITTER "/icon_size"