Package: twitux Version: 0.69-4 Severity: normal Tags: patch I have written up a patch to fix the issue where, when replying to a Direct Message, the reply is an "at-reply".
Parts of this patch were taken from an upstream patch. Upstream had created a patch to do much the same thing, but the way they implemented it looked unpolished and more like an after thought. The main reason their patch was unusable to me was they sent a DM using the "d <user> <message>" format in a normal update. This takes away characters that I could be using for the message (The same can be observed when DMing with the status box on Twitter.com vs. using their dedicated DM form). Patch attached (Wrote this on top of some personal patches (Bug reports about those to come), so it may take some finagling to get it to apply) Hope this is useful! -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (900, 'testing'), (850, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.30-2-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages twitux depends on: ii dbus-x11 1.2.16-2 simple interprocess messaging syst ii gconf2 2.28.0-1 GNOME configuration database syste ii gnome-keyring 2.28.1-1 GNOME keyring services (daemon and ii libc6 2.10.1-5 GNU C Library: Shared libraries ii libcanberra-gtk0 0.22-1 Gtk+ helper for playing widget eve ii libcanberra0 0.22-1 a simple abstract interface for pl ii libdbus-1-3 1.2.16-2 simple interprocess messaging syst ii libdbus-glib-1-2 0.82-2 simple interprocess messaging syst ii libenchant1c2a 1.4.2-3.3 a wrapper library for various spel ii libgconf2-4 2.28.0-1 GNOME configuration database syste ii libglib2.0-0 2.22.2-2 The GLib library of C routines ii libgnome-keyring0 2.28.1-1 GNOME keyring services library ii libgtk2.0-0 2.18.3-1 The GTK+ graphical user interface ii libnotify1 [libnotify1-gtk2 0.4.5-1 sends desktop notifications to a n ii libsexy2 0.1.11-2+b1 collection of additional GTK+ widg ii libsoup2.4-1 2.28.1-2 an HTTP library implementation in ii libxml2 2.7.6.dfsg-1 GNOME XML library twitux recommends no packages. twitux suggests no packages. -- no debconf information
--- a/src/twitux-parser.c Sun Nov 08 13:13:03 2009 -0800 +++ b/src/twitux-parser.c Sun Nov 08 19:30:10 2009 -0800 @@ -228,6 +228,18 @@ TWITUX_PREFS_AUTH_USER_ID, &localuser); + /* get timeline type */ + cur_node = root_element; + while (cur_node && cur_node->type != XML_ELEMENT_NODE) + cur_node = cur_node->next; + if (cur_node) { + if (g_str_equal (cur_node->name, "direct-messages")) + twitux_tweet_list_set_timeline_type (DIRECT_MESSAGES); + else if (g_str_equal (cur_node->name, "statuses")) + twitux_tweet_list_set_timeline_type (STATUSES); + } + + /* get tweets or direct messages */ for (cur_node = root_element; cur_node; cur_node = cur_node->next) { if (cur_node->type != XML_ELEMENT_NODE) --- a/src/twitux-send-message-dialog.c Sun Nov 08 13:13:03 2009 -0800 +++ b/src/twitux-send-message-dialog.c Sun Nov 08 19:30:10 2009 -0800 @@ -69,6 +69,9 @@ GtkWidget *friends_combo; GtkWidget *friends_label; gboolean show_friends; + GList *friends; + + gchar *dm_user; }; static void twitux_message_class_init (TwituxMsgDialogClass *klass); @@ -155,6 +158,8 @@ "send_message_textview", "populate_popup", message_text_populate_popup_cb, NULL); + priv->friends = NULL; + g_object_unref (ui); /* Set the label */ @@ -282,6 +287,18 @@ } void +twitux_message_set_recipient (gchar *user) +{ + TwituxMsgDialogPriv *priv = GET_PRIV (dialog); + + priv->dm_user = user; + + gtk_label_set_text((GtkLabel*)(priv->friends_label), g_strdup_printf("Direct Message to %s", user)); + + gtk_widget_hide (priv->friends_combo); +} + +void twitux_message_set_message (const gchar *message) { TwituxMsgDialogPriv *priv = GET_PRIV (dialog); @@ -553,8 +570,10 @@ text = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, TRUE); good_msg = url_encode_message (text); - if (priv->show_friends) - { + if(priv->dm_user != NULL){ + twitux_debug("SendMessage", g_strdup_printf("Sent to %s", priv->dm_user)); + twitux_network_send_message (priv->dm_user, good_msg); + } else if (priv->show_friends){ GtkTreeIter iter; gchar *to_user; GtkComboBox *combo = GTK_COMBO_BOX (priv->friends_combo); --- a/src/twitux-send-message-dialog.h Sun Nov 08 13:13:03 2009 -0800 +++ b/src/twitux-send-message-dialog.h Sun Nov 08 19:30:10 2009 -0800 @@ -58,6 +58,7 @@ GtkTextIter start, GtkTextIter end, const gchar *new_word); +void twitux_message_set_recipient (gchar *user); void twitux_message_set_followers (GList *followers); void twitux_message_show_friends (gboolean show_friends); void twitux_message_set_message (const gchar *message); --- a/src/twitux-tweet-list.c Sun Nov 08 13:13:03 2009 -0800 +++ b/src/twitux-tweet-list.c Sun Nov 08 19:30:10 2009 -0800 @@ -39,6 +39,7 @@ struct _TwituxTweetListPriv { GtkListStore *store; + int timeline_type; GtkTreeViewColumn *text_column; GtkCellRenderer *text_renderer; @@ -263,6 +264,8 @@ t = TWITUX_TWEET_LIST (user_data); priv = GET_PRIV (t); + message = NULL; + gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->store), &iter, path); @@ -272,10 +275,15 @@ STRING_USER, &user, -1); - message = g_strdup_printf ("@%s ", user); - twitux_send_message_dialog_show (NULL); - twitux_message_show_friends (FALSE); - twitux_message_set_message (message); + if (priv->timeline_type == DIRECT_MESSAGES) { + twitux_send_message_dialog_show (NULL); + twitux_message_set_recipient(g_strdup_printf("%s", user)); + } else { + message = g_strdup_printf ("@%s ", user); + twitux_send_message_dialog_show (NULL); + twitux_message_show_friends (FALSE); + twitux_message_set_message (message); + } g_free (user); g_free (message); @@ -331,3 +339,12 @@ return priv->store; } + +void +twitux_tweet_list_set_timeline_type (int type) +{ + TwituxTweetListPriv *priv; + + priv = GET_PRIV (list); + priv->timeline_type = type; +} --- a/src/twitux-tweet-list.h Sun Nov 08 13:13:03 2009 -0800 +++ b/src/twitux-tweet-list.h Sun Nov 08 19:30:10 2009 -0800 @@ -50,10 +50,16 @@ GtkTreeViewClass parent_class; }; +enum { + STATUSES, + DIRECT_MESSAGES +}; + GType twitux_tweet_list_get_type (void) G_GNUC_CONST; void twitux_tweet_list_retweet (void); TwituxTweetList * twitux_tweet_list_new (void); GtkListStore * twitux_tweet_list_get_store (void); +void twitux_tweet_list_set_timeline_type (int type); G_END_DECLS