aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/twitter/twitter_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/twitter/twitter_lib.c')
-rw-r--r--protocols/twitter/twitter_lib.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c
index 620850ab..dfb5597f 100644
--- a/protocols/twitter/twitter_lib.c
+++ b/protocols/twitter/twitter_lib.c
@@ -364,7 +364,8 @@ static xt_status twitter_xt_get_user_list( struct xt_node *node, struct twitter_
*/
static xt_status twitter_xt_get_status( struct xt_node *node, struct twitter_xml_status *txs )
{
- struct xt_node *child;
+ struct xt_node *child, *rt;
+ gboolean truncated = FALSE;
// Walk over the nodes children.
for( child = node->children ; child ; child = child->next )
@@ -373,6 +374,14 @@ static xt_status twitter_xt_get_status( struct xt_node *node, struct twitter_xml
{
txs->text = g_memdup( child->text, child->text_len + 1 );
}
+ else if (g_strcasecmp( "truncated", child->name ) == 0 && child->text)
+ {
+ truncated = bool2int(child->text);
+ }
+ else if (g_strcasecmp( "retweeted_status", child->name ) == 0)
+ {
+ rt = child;
+ }
else if (g_strcasecmp( "created_at", child->name ) == 0)
{
struct tm parsed;
@@ -393,6 +402,22 @@ static xt_status twitter_xt_get_status( struct xt_node *node, struct twitter_xml
txs->id = g_ascii_strtoull (child->text, NULL, 10);
}
}
+
+ /* If it's a truncated retweet, get the original because dots suck. */
+ if (truncated && rt)
+ {
+ struct twitter_xml_status *rtxs = g_new0(struct twitter_xml_status, 1);
+ if (twitter_xt_get_status(rt, rtxs) != XT_HANDLED)
+ {
+ txs_free(rtxs);
+ return XT_HANDLED;
+ }
+
+ g_free(txs->text);
+ txs->text = g_strdup_printf("RT @%s: %s", rtxs->user->screen_name, rtxs->text);
+ txs_free(rtxs);
+ }
+
return XT_HANDLED;
}