diff pidgin-twitter.c @ 200:9a2d727f39b4

removed jisko support as a protest to their expulsion policy.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 11 Aug 2008 14:31:54 +0900
parents 5ddf8bee768d
children 0aeeafe37ef7
line wrap: on
line diff
--- a/pidgin-twitter.c	Mon Aug 11 10:17:46 2008 +0900
+++ b/pidgin-twitter.c	Mon Aug 11 14:31:54 2008 +0900
@@ -24,8 +24,8 @@
 /***********/
 /* globals */
 /***********/
-#define NUM_REGPS 12
-#define NUM_SERVICES 4          /* twitter, wassr, identica, jisko. */
+#define NUM_REGPS 11
+#define NUM_SERVICES 3          /* twitter, wassr, identica. */
 static GRegex *regp[NUM_REGPS];
 static gboolean suppress_oops = FALSE;
 static GHashTable *icon_hash[NUM_SERVICES];
@@ -849,9 +849,6 @@
         case identica_service:
             format = RECIPIENT_FORMAT_IDENTICA;
             break;
-        case jisko_service:
-            format = RECIPIENT_FORMAT_JISKO;
-            break;
         default:
             twitter_debug("unknown service\n");
             break;
@@ -874,9 +871,6 @@
         case identica_service:
             format = SENDER_FORMAT_IDENTICA;
             break;
-        case jisko_service:
-            format = SENDER_FORMAT_JISKO;
-            break;
         default:
             twitter_debug("unknown service\n");
             break;
@@ -1003,9 +997,6 @@
         case identica_service:
             screen_name = purple_prefs_get_string(OPT_SCREEN_NAME_IDENTICA);
             break;
-        case jisko_service:
-            screen_name = purple_prefs_get_string(OPT_SCREEN_NAME_JISKO);
-            break;
         }
 
         if (screen_name) {
@@ -1088,18 +1079,6 @@
         markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>",
                                          bytes <= 140 ? "black" : "red", bytes);
         break;
-    case jisko_service:
-        gtk_text_buffer_get_start_iter(textbuffer, &head);
-        gtk_text_buffer_get_end_iter(textbuffer, &tail);
-
-        text = gtk_text_buffer_get_text(textbuffer, &head, &tail, TRUE);
-        if(text)
-            bytes = strlen(text) + new_text_length;
-        g_free(text);
-        markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>",
-                                         bytes >= 5 && bytes <= 140 ?
-                                         "black" : "red", bytes);
-        break;
     default:
         twitter_debug("unknown service\n");
         break;
@@ -1163,26 +1142,6 @@
         markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>",
                                          bytes <= 140 ? "black" : "red", bytes);
         break;
-    case jisko_service:
-        gtk_text_buffer_get_start_iter(textbuffer, &head);
-        gtk_text_buffer_get_end_iter(textbuffer, &tail);
-
-        text = gtk_text_buffer_get_text(textbuffer,
-                                        &head, &tail, TRUE);
-        if(text)
-            bytes = strlen(text);
-        g_free(text);
-
-        text = gtk_text_buffer_get_text(textbuffer,
-                                        start_pos, end_pos, TRUE);
-        if(text)
-            bytes -= strlen(text);
-        g_free(text);
-
-        markup = g_markup_printf_escaped("<span color=\"%s\">%u</span>",
-                                         bytes >= 5 && bytes <= 140 ?
-                                         "black" : "red", bytes);
-        break;
     default:
         twitter_debug("unknown service\n");
         break;
@@ -1211,7 +1170,6 @@
         case twitter_service:
         case wassr_service:
         case identica_service:
-        case jisko_service:
             detach_from_conv(conv, NULL);
             break;
         default:
@@ -1323,7 +1281,6 @@
         case twitter_service:
         case wassr_service:
         case identica_service:
-        case jisko_service:
             attach_to_conv(conv, NULL);
             break;
         default:
@@ -1465,30 +1422,6 @@
     return is_identica_account(account, name);
 }
 
-static gboolean
-is_jisko_account(PurpleAccount *account, const char *name)
-{
-    const gchar *proto = purple_account_get_protocol_id(account);
-
-    if(g_strstr_len(name,  16, "bot@jisko.net") &&
-       g_strstr_len(proto, 11, "prpl-jabber")) {
-        return TRUE;
-    }
-
-    return FALSE;
-}
-
-static gboolean
-is_jisko_conv(PurpleConversation *conv)
-{
-    g_return_val_if_fail(conv != NULL, FALSE);
-
-    const char *name = purple_conversation_get_name(conv);
-    PurpleAccount *account = purple_conversation_get_account(conv);
-
-    return is_jisko_account(account, name);
-}
-
 static gint
 get_service_type(PurpleConversation *conv)
 {
@@ -1502,8 +1435,6 @@
         service = wassr_service;
     else if(is_identica_conv(conv))
         service = identica_service;
-    else if(is_jisko_conv(conv))
-        service = jisko_service;
 
     return service;
 }
@@ -1530,7 +1461,6 @@
         break;
     case wassr_service:
     case identica_service:
-    case jisko_service:
         attach_to_conv(conv, NULL);
         break;
     default:
@@ -1567,9 +1497,6 @@
     case identica_service:
         hash = icon_hash[identica_service];
         break;
-    case jisko_service:
-        hash = icon_hash[jisko_service];
-        break;
     default:
         twitter_debug("unknown service\n");
         break;
@@ -1707,9 +1634,6 @@
     case identica_service:
         hash = icon_hash[identica_service];
         break;
-    case jisko_service:
-        hash = icon_hash[jisko_service];
-        break;
     default:
         twitter_debug("unknown service\n");
     }
@@ -1756,9 +1680,6 @@
     case identica_service:
         hash = icon_hash[identica_service];
         break;
-    case jisko_service:
-        hash = icon_hash[jisko_service];
-        break;
     default:
         twitter_debug("unknown service\n");
         break;
@@ -1817,11 +1738,6 @@
             icon_hash[identica_service], user_name);
         regp_id = IMAGE_IDENTICA;
     }
-    else if(service == jisko_service) {
-        data = (icon_data *)g_hash_table_lookup(
-            icon_hash[jisko_service], user_name);
-        regp_id = IMAGE_JISKO;
-    }
 
     if(!url_text) {
         if(data) {
@@ -1984,9 +1900,6 @@
     case identica_service:
         hash = icon_hash[identica_service];
         break;
-    case jisko_service:
-        hash = icon_hash[jisko_service];
-        break;
     default:
         twitter_debug("unknown service\n");
     }
@@ -2058,9 +1971,6 @@
         case identica_service:
             suffix = "identica";
             break;
-        case jisko_service:
-            suffix = "jisko";
-            break;
         default:
             twitter_debug("unknown service\n");
             break;
@@ -2125,10 +2035,6 @@
         suffix = "identica";
         hash = icon_hash[identica_service];
         break;
-    case jisko_service:
-        suffix = "jisko";
-        hash = icon_hash[jisko_service];
-        break;
     default:
         twitter_debug("unknown service\n");
         break;
@@ -2214,9 +2120,6 @@
     case identica_service:
         url = g_strdup_printf("http://identi.ca/%s", user_name);
         break;
-    case jisko_service:
-        url = g_strdup_printf("http://jisko.net/%s", user_name);
-        break;
     default:
         twitter_debug("unknown service\n");
         break;
@@ -2230,8 +2133,7 @@
         /* gotdata will be released in got_icon_cb */
         if(service == twitter_service ||
            service == wassr_service ||
-           service == identica_service ||
-           service == jisko_service) {
+           service == identica_service) {
             data->fetch_data = purple_util_fetch_url(url, TRUE, NULL, TRUE,
                                                      got_page_cb, gotdata);
         }
@@ -2263,9 +2165,6 @@
     case identica_service:
         hash = icon_hash[identica_service];
         break;
-    case jisko_service:
-        hash = icon_hash[jisko_service];
-        break;
     default:
         twitter_debug("unknown service\n");
         break;
@@ -2365,9 +2264,6 @@
     case identica_service:
         hash = icon_hash[identica_service];
         break;
-    case jisko_service:
-        hash = icon_hash[jisko_service];
-        break;
     default:
         twitter_debug("unknown service\n");
         break;
@@ -2517,7 +2413,6 @@
     regp[IMAGE_TWITTER]  = g_regex_new(P_IMAGE_TWITTER, 0, 0, NULL);
     regp[IMAGE_WASSR]    = g_regex_new(P_IMAGE_WASSR, 0, 0, NULL);
     regp[IMAGE_IDENTICA] = g_regex_new(P_IMAGE_IDENTICA, 0, 0, NULL);
-    regp[IMAGE_JISKO]    = g_regex_new(P_IMAGE_JISKO, 0, 0, NULL);
 
     for(i = twitter_service; i < NUM_SERVICES; i++) {
         icon_hash[i] = g_hash_table_new_full(g_str_hash, g_str_equal,
@@ -2796,13 +2691,6 @@
     g_signal_connect(e, "changed",
                      G_CALLBACK(text_changed_cb), &e);
 
-    e = GTK_WIDGET(gtk_builder_get_object (builder, "account_jisko"));
-    g_object_set_data(G_OBJECT(e), "pref", OPT_SCREEN_NAME_JISKO);
-    text = purple_prefs_get_string(OPT_SCREEN_NAME_JISKO);
-    gtk_entry_set_text(GTK_ENTRY(e), text);
-    g_signal_connect(e, "changed",
-                     G_CALLBACK(text_changed_cb), &e);
-
     e = GTK_WIDGET(gtk_builder_get_object (builder, "account_api"));
     g_object_set_data(G_OBJECT(e), "pref", OPT_API_BASE_POST);
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(e),