aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/twitter/twitter.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-08-07 22:06:24 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-08-07 22:06:24 +0100
commit203a2d2e8857e4c83f8f5e1a89de03ea08538cb2 (patch)
treea55e88fda74a3c77c29890e6da53e1c2b6e987d5 /protocols/twitter/twitter.c
parent7b87539aedd967884d4e4eed75d1052a233720eb (diff)
Allow protocol modules to keep per-contact protocol-specific data. Use
this in the Twitter module to remember the id and timestamp of a contact's last tweet, which can later be used for simple replies/retweets.
Diffstat (limited to 'protocols/twitter/twitter.c')
-rw-r--r--protocols/twitter/twitter.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c
index 85d10a56..ca279b8f 100644
--- a/protocols/twitter/twitter.c
+++ b/protocols/twitter/twitter.c
@@ -394,6 +394,16 @@ static int twitter_send_typing( struct im_connection *ic, char *who, int typing
// return value;
//}
+static void twitter_buddy_data_add( struct bee_user *bu )
+{
+ bu->data = g_new0( struct twitter_user_data, 1 );
+}
+
+static void twitter_buddy_data_free( struct bee_user *bu )
+{
+ g_free( bu->data );
+}
+
static void twitter_handle_command( struct im_connection *ic, char *message )
{
struct twitter_data *td = ic->proto_data;
@@ -407,7 +417,7 @@ static void twitter_handle_command( struct im_connection *ic, char *message )
g_free( cmds );
return;
}
- else if( !set_getbool( &ic->set, "commands" ) )
+ else if( !set_getbool( &ic->acc->set, "commands" ) )
{
/* Not supporting commands. */
}
@@ -490,6 +500,8 @@ void twitter_initmodule()
ret->add_deny = twitter_add_deny;
ret->rem_deny = twitter_rem_deny;
ret->send_typing = twitter_send_typing;
+ ret->buddy_data_add = twitter_buddy_data_add;
+ ret->buddy_data_free = twitter_buddy_data_free;
ret->handle_cmp = g_strcasecmp;
register_protocol(ret);