Ticket #650: patch-protocols_twitter_twitter__lib.c

File patch-protocols_twitter_twitter__lib.c, 1.8 KB (added by wahjava@…, at 2010-07-13T10:47:36Z)

diff for protocols/twitter/twitter_lib.c

Line 
1
2$FreeBSD$
3
4--- protocols/twitter/twitter_lib.c.orig
5+++ protocols/twitter/twitter_lib.c
6@@ -77,7 +77,8 @@
7 static void txs_free(struct twitter_xml_status *txs)
8 {
9        g_free(txs->text);
10-       txu_free(txs->user);
11+       if(txs->user)
12+               txu_free(txs->user);
13        g_free(txs);
14 }
15 
16@@ -472,19 +473,22 @@
17        for ( l = list; l ; l = g_slist_next(l) )
18        {
19                status = l->data;
20-               twitter_add_buddy(ic, status->user->screen_name, status->user->name);
21-               
22-               strip_html(status->text);
23+               if(status->user)
24+               {
25+                       twitter_add_buddy(ic, status->user->screen_name, status->user->name);
26               
27-               // Say it!
28-               if (g_strcasecmp(td->user, status->user->screen_name) == 0)
29-                       imcb_chat_log (gc, "Your Tweet: %s", status->text);
30-               else
31-                       imcb_chat_msg (gc, status->user->screen_name, status->text, 0, status->created_at );
32+                       strip_html(status->text);
33               
34-               // Update the home_timeline_id to hold the highest id, so that by the next request
35-               // we won't pick up the updates allready in the list.
36-               td->home_timeline_id = td->home_timeline_id < status->id ? status->id : td->home_timeline_id;
37+                       // Say it!
38+                       if (g_strcasecmp(td->user, status->user->screen_name) == 0)
39+                               imcb_chat_log (gc, "Your Tweet: %s", status->text);
40+                       else
41+                               imcb_chat_msg (gc, status->user->screen_name, status->text, 0, status->created_at );
42+                       
43+                       // Update the home_timeline_id to hold the highest id, so that by the next request
44+                       // we won't pick up the updates allready in the list.
45+                       td->home_timeline_id = td->home_timeline_id < status->id ? status->id : td->home_timeline_id;
46+               }
47        }
48 }
49 
50@@ -735,4 +739,4 @@
51        args[0] = "screen_name";
52        args[1] = who;
53        twitter_http(ic, create ? TWITTER_FRIENDSHIPS_CREATE_URL : TWITTER_FRIENDSHIPS_DESTROY_URL, twitter_http_post, ic, 1, args, 2);
54-}
55\ No newline at end of file
56+}