public
Description: A Clutter-based Twitter client
Homepage: http://live.gnome.org/Tweet
Clone URL: git://github.com/ebassi/tweet.git
Add the in-reply-to accessors to TwitterStatus

A Twitter status can be in reply of a user or a status from a user.
Twitter will will two fields in the status structure with the ID of
the user and the status we a replying to - so we can link or retrieve
both.

TwitterStatus now parses those fields has the API to access that
data.
Emmanuele Bassi (author)
Thu May 22 00:50:49 -0700 2008
commit  2a2ca1a01906296b703686bf803e8ed807e31ff4
tree    32aa4463b8e8db060a9d8d4b9dcc38dc52aefcd2
parent  57b80923b7fae0106720cdabe1f897ccc1b1a212
...
41
42
43
 
 
 
44
45
46
...
53
54
55
56
 
 
 
57
58
59
...
119
120
121
 
 
 
 
 
 
 
 
122
123
124
...
177
178
179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
181
182
...
260
261
262
 
 
 
 
 
 
 
 
263
264
265
...
383
384
385
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
41
42
43
44
45
46
47
48
49
...
56
57
58
 
59
60
61
62
63
64
...
124
125
126
127
128
129
130
131
132
133
134
135
136
137
...
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
...
287
288
289
290
291
292
293
294
295
296
297
298
299
300
...
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
0
@@ -41,6 +41,9 @@ struct _TwitterStatusPrivate
0
 
0
   guint id;
0
 
0
+ guint in_reply_to_user_id;
0
+ guint in_reply_to_status_id;
0
+
0
   guint truncated : 1;
0
 };
0
 
0
@@ -53,7 +56,9 @@ enum
0
   PROP_CREATED_AT,
0
   PROP_TEXT,
0
   PROP_ID,
0
- PROP_TRUNCATED
0
+ PROP_TRUNCATED,
0
+ PROP_REPLY_TO_USER,
0
+ PROP_REPLY_TO_STATUS
0
 };
0
 
0
 enum
0
@@ -119,6 +124,14 @@ twitter_status_get_property (GObject *gobject,
0
       g_value_set_boolean (value, priv->truncated);
0
       break;
0
 
0
+ case PROP_REPLY_TO_USER:
0
+ g_value_set_uint (value, priv->in_reply_to_user_id);
0
+ break;
0
+
0
+ case PROP_REPLY_TO_STATUS:
0
+ g_value_set_uint (value, priv->in_reply_to_status_id);
0
+ break;
0
+
0
     default:
0
       G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
0
       break;
0
@@ -177,6 +190,20 @@ twitter_status_class_init (TwitterStatusClass *klass)
0
                                                          "Whether this status was truncated",
0
                                                          FALSE,
0
                                                          G_PARAM_READABLE));
0
+ g_object_class_install_property (gobject_class,
0
+ PROP_REPLY_TO_USER,
0
+ g_param_spec_uint ("reply-to-user",
0
+ "Reply To User",
0
+ "The unique id of the user whom the status replies to",
0
+ 0, G_MAXUINT, 0,
0
+ G_PARAM_READABLE));
0
+ g_object_class_install_property (gobject_class,
0
+ PROP_REPLY_TO_STATUS,
0
+ g_param_spec_uint ("reply-to-status",
0
+ "Reply To Status",
0
+ "The unique id of the status which the status replies to",
0
+ 0, G_MAXUINT, 0,
0
+ G_PARAM_READABLE));
0
 
0
   status_signals[CHANGED] =
0
     g_signal_new ("changed",
0
@@ -260,6 +287,14 @@ twitter_status_build (TwitterStatus *status,
0
   member = json_object_get_member (obj, "text");
0
   if (member)
0
     priv->text = json_node_dup_string (member);
0
+
0
+ member = json_object_get_member (obj, "in_reply_to_user_id");
0
+ if (member)
0
+ priv->in_reply_to_user_id = json_node_get_int (member);
0
+
0
+ member = json_object_get_member (obj, "in_reply_to_status_id");
0
+ if (member)
0
+ priv->in_reply_to_status_id = json_node_get_int (member);
0
 }
0
 
0
 TwitterStatus *
0
@@ -383,3 +418,19 @@ twitter_status_get_text (TwitterStatus *status)
0
 
0
   return status->priv->text;
0
 }
0
+
0
+guint
0
+twitter_status_get_reply_to_user (TwitterStatus *status)
0
+{
0
+ g_return_val_if_fail (TWITTER_IS_STATUS (status), 0);
0
+
0
+ return status->priv->in_reply_to_user_id;
0
+}
0
+
0
+guint
0
+twitter_status_get_reply_to_status (TwitterStatus *status)
0
+{
0
+ g_return_val_if_fail (TWITTER_IS_STATUS (status), 0);
0
+
0
+ return status->priv->in_reply_to_status_id;
0
+}
...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
44
45
...
28
29
30
 
 
 
 
 
 
 
 
 
 
 
 
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
0
@@ -28,18 +28,20 @@ G_BEGIN_DECLS
0
 
0
 GType twitter_status_get_type (void) G_GNUC_CONST;
0
 
0
-TwitterStatus * twitter_status_new (void);
0
-TwitterStatus * twitter_status_new_from_data (const gchar *buffer);
0
-
0
-void twitter_status_load_from_data (TwitterStatus *status,
0
- const gchar *buffer);
0
-
0
-TwitterUser * twitter_status_get_user (TwitterStatus *status);
0
-G_CONST_RETURN gchar *twitter_status_get_source (TwitterStatus *status);
0
-G_CONST_RETURN gchar *twitter_status_get_created_at (TwitterStatus *status);
0
-guint twitter_status_get_id (TwitterStatus *status);
0
-gboolean twitter_status_get_truncated (TwitterStatus *status);
0
-G_CONST_RETURN gchar *twitter_status_get_text (TwitterStatus *status);
0
+TwitterStatus * twitter_status_new (void);
0
+TwitterStatus * twitter_status_new_from_data (const gchar *buffer);
0
+
0
+void twitter_status_load_from_data (TwitterStatus *status,
0
+ const gchar *buffer);
0
+
0
+TwitterUser * twitter_status_get_user (TwitterStatus *status);
0
+G_CONST_RETURN gchar *twitter_status_get_source (TwitterStatus *status);
0
+G_CONST_RETURN gchar *twitter_status_get_created_at (TwitterStatus *status);
0
+guint twitter_status_get_id (TwitterStatus *status);
0
+gboolean twitter_status_get_truncated (TwitterStatus *status);
0
+G_CONST_RETURN gchar *twitter_status_get_text (TwitterStatus *status);
0
+guint twitter_status_get_reply_to_user (TwitterStatus *status);
0
+guint twitter_status_get_reply_to_status (TwitterStatus *status);
0
 
0
 G_END_DECLS
0
 

Comments

    No one has commented yet.