diff options
| author | Flexo <nick@nivan.net> | 2016-03-31 18:49:52 +0000 | 
|---|---|---|
| committer | Flexo <nick@nivan.net> | 2016-03-31 18:49:52 +0000 | 
| commit | 9cf63aca0ffdc0cf708c3d17ee3ae9f92fa7cbf8 (patch) | |
| tree | e153efbac9f45c6f5abd7223cc43919a638110a9 /protocols | |
| parent | fb62f132a55896e235fd4956987548bdcd0be519 (diff) | |
Add mute and unmute commands.
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/twitter/twitter.c | 6 | ||||
| -rw-r--r-- | protocols/twitter/twitter_lib.c | 13 | ||||
| -rw-r--r-- | protocols/twitter/twitter_lib.h | 5 | 
3 files changed, 24 insertions, 0 deletions
| diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 94c88b71..e543f86e 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -957,6 +957,12 @@ static void twitter_handle_command(struct im_connection *ic, char *message)  	} else if (g_strcasecmp(cmd[0], "unfollow") == 0 && cmd[1]) {  		twitter_remove_buddy(ic, cmd[1], NULL);  		goto eof; +	} else if (g_strcasecmp(cmd[0], "mute") == 0 && cmd[1]) { +		twitter_mute_create_destroy(ic, cmd[1], 1); +		goto eof; +	} else if (g_strcasecmp(cmd[0], "unmute") == 0 && cmd[1]) { +		twitter_mute_create_destroy(ic, cmd[1], 0); +		goto eof;  	} else if ((g_strcasecmp(cmd[0], "report") == 0 ||  	            g_strcasecmp(cmd[0], "spam") == 0) && cmd[1]) {  		char *screen_name; diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 288e0207..6b38bd7c 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -1652,6 +1652,19 @@ void twitter_friendships_create_destroy(struct im_connection *ic, char *who, int  	             twitter_http_post, ic, 1, args, 2);  } +/** + * Mute or unmute a user + */ +void twitter_mute_create_destroy(struct im_connection *ic, char *who, int create) +{ +	char *args[2]; + +	args[0] = "screen_name"; +	args[1] = who; +	twitter_http(ic, create ? TWITTER_MUTES_CREATE_URL : TWITTER_MUTES_DESTROY_URL, +		     twitter_http_post, ic, 1, args, 2); +} +  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 44f20cbc..6833d23d 100644 --- a/protocols/twitter/twitter_lib.h +++ b/protocols/twitter/twitter_lib.h @@ -77,6 +77,10 @@  #define TWITTER_BLOCKS_CREATE_URL "/blocks/create/"  #define TWITTER_BLOCKS_DESTROY_URL "/blocks/destroy/" +/* Mute URLs */ +#define TWITTER_MUTES_CREATE_URL "/mutes/users/create.json" +#define TWITTER_MUTES_DESTROY_URL "/mutes/users/destroy.json" +  /* Report spam */  #define TWITTER_REPORT_SPAM_URL "/users/report_spam.json" @@ -95,6 +99,7 @@ void twitter_get_statuses_friends(struct im_connection *ic, gint64 next_cursor);  void twitter_post_status(struct im_connection *ic, char *msg, guint64 in_reply_to);  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_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); | 
