changeset 332:227852ee649c

do not append "in_reply_to_status_id" when msdid is 0.
author Yoshiki Yazawa <[email protected]>
date Tue, 13 Oct 2009 03:10:32 +0900
parents b4c846870b3c
children dff611cb9f7b
files main.c twitter_api.c util.c
diffstat 3 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Tue Oct 13 02:45:03 2009 +0900
+++ b/main.c	Tue Oct 13 03:10:32 2009 +0900
@@ -410,10 +410,9 @@
         playsound(buffer, RECIPIENT);
     }
 
-    if(service == twitter_service) {
-        /* replace ptmsgid=123 with appropriate links */
+    /* make R F RT link */
+    if(service == twitter_service)
         linkstr = twitter_make_link_string(buffer);
-    }
 
     /* translate */
     if(purple_prefs_get_bool(OPT_TRANSLATE_SENDER)) {
--- a/twitter_api.c	Tue Oct 13 02:45:03 2009 +0900
+++ b/twitter_api.c	Tue Oct 13 03:10:32 2009 +0900
@@ -555,6 +555,11 @@
         purple_prefs_get_string(OPT_SCREEN_NAME_TWITTER);
     const char *password = purple_prefs_get_string(OPT_PASSWORD_TWITTER);
 
+    if(id == 0) {
+        twitter_debug("invalid message id\n");
+        return;
+    }
+
     if (!screen_name || !password || !screen_name[0] || !password[0]) {
         twitter_debug("screen_name or password is empty\n");
         return;
--- a/util.c	Tue Oct 13 02:45:03 2009 +0900
+++ b/util.c	Tue Oct 13 03:10:32 2009 +0900
@@ -525,9 +525,9 @@
 {
     GMatchInfo *match_info = NULL;
     gchar *boddy0 = NULL, *boddy = NULL;
-    gchar *newstr = NULL, *match = NULL;
-    gchar *linkstr = NULL;
-    gchar *user = NULL;
+    gchar *newstr = NULL, *linkstr = NULL;
+    gchar *match = NULL;
+    gchar *idstr = NULL, *user = NULL;
 
     twitter_debug("called\n");
 
@@ -555,10 +555,11 @@
     g_regex_match(regp[MESSAGE_ID], *str, 0, &match_info);
     if(match_info) {
         match = g_match_info_fetch(match_info, 1);
+        idstr = match ? match : "0";
         linkstr = g_strdup_printf(LINK_FORMAT_TWITTER,
-                                 match, user,          /* Reply */
-                                 match,                /* Favorite */
-                                 match, user, boddy);  /* Retweet */
+                                  idstr, user,         /* Reply */
+                                  idstr,               /* Favorite */
+                                  idstr, user, boddy); /* Retweet */
 
         twitter_debug("linkstr = %s\n", linkstr);