aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2016-08-01 13:04:29 +0200
committerMarius Halden <marius.h@lden.org>2016-08-01 13:04:29 +0200
commit14dc4bb2fec1422721dc038bd9a4412c8bb8e67f (patch)
treeb1d7d17ce86f730b9e252e03533cf4017afa0dbb
parent94f613581320f660204bf967aafd74e6450b1389 (diff)
Add commands to enable/disable rts for user
-rw-r--r--protocols/twitter/twitter.c6
-rw-r--r--protocols/twitter/twitter_lib.c13
-rw-r--r--protocols/twitter/twitter_lib.h2
3 files changed, 21 insertions, 0 deletions
diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c
index 0d635b21..f374c33d 100644
--- a/protocols/twitter/twitter.c
+++ b/protocols/twitter/twitter.c
@@ -1096,6 +1096,12 @@ static void twitter_handle_command(struct im_connection *ic, char *message)
twitter_direct_messages_new(ic, cmd[1], cmd[2]);
}
goto eof;
+ } else if (g_strcasecmp(cmd[0], "rtoff") == 0 && cmd[1]) {
+ twitter_retweet_enable_disable(ic, cmd[1], 0);
+ goto eof;
+ } else if (g_strcasecmp(cmd[0], "rton") == 0 && cmd[1]) {
+ twitter_retweet_enable_disable(ic, cmd[1], 1);
+ goto eof;
}
if (allow_post) {
diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c
index 4ef22345..011c31ab 100644
--- a/protocols/twitter/twitter_lib.c
+++ b/protocols/twitter/twitter_lib.c
@@ -1742,6 +1742,19 @@ void twitter_mute_create_destroy(struct im_connection *ic, char *who, int create
twitter_http_post, ic, 1, args, 2);
}
+/**
+ * Enable or disable retweets for user
+ */
+void twitter_retweet_enable_disable(struct im_connection *ic, char *who, int enable)
+{
+ char *args[4];
+ args[0] = "screen_name";
+ args[1] = who;
+ args[2] = "retweets";
+ args[3] = enable ? "true" : "false";
+ twitter_http(ic, TWITTER_FRIENDSHIPS_UPDATE_URL, twitter_http_post, ic, 1, args, 4);
+}
+
void twitter_status_destroy(struct im_connection *ic, guint64 id)
{
char *url;
diff --git a/protocols/twitter/twitter_lib.h b/protocols/twitter/twitter_lib.h
index d3b6ae9e..e520e8b5 100644
--- a/protocols/twitter/twitter_lib.h
+++ b/protocols/twitter/twitter_lib.h
@@ -58,6 +58,7 @@
#define TWITTER_FRIENDSHIPS_CREATE_URL "/friendships/create.json"
#define TWITTER_FRIENDSHIPS_DESTROY_URL "/friendships/destroy.json"
#define TWITTER_FRIENDSHIPS_SHOW_URL "/friendships/show.json"
+#define TWITTER_FRIENDSHIPS_UPDATE_URL "/friendships/update.json"
/* Social graphs URLs */
#define TWITTER_FRIENDS_IDS_URL "/friends/ids.json"
@@ -100,6 +101,7 @@ void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_t
void twitter_direct_messages_new(struct im_connection *ic, char *who, char *message);
void twitter_friendships_create_destroy(struct im_connection *ic, char *who, int create);
void twitter_mute_create_destroy(struct im_connection *ic, char *who, int create);
+void twitter_retweet_enable_disable(struct im_connection *ic, char *who, int enable);
void twitter_status_destroy(struct im_connection *ic, guint64 id);
void twitter_status_retweet(struct im_connection *ic, guint64 id);
void twitter_report_spam(struct im_connection *ic, char *screen_name);