diff options
author | dequis <dx@dxzone.com.ar> | 2015-09-15 20:37:33 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-09-15 20:37:33 -0300 |
commit | 0606954a44b78e425043894703f971e083c6e4ed (patch) | |
tree | 72e985e98e431c87b337cced0b5fdf05977a0da7 | |
parent | 073a946ffd188dbce9abf95633c4d9108401e533 (diff) | |
download | bitlbee-facebook-0606954a44b78e425043894703f971e083c6e4ed.tar.gz bitlbee-facebook-0606954a44b78e425043894703f971e083c6e4ed.tar.bz2 bitlbee-facebook-0606954a44b78e425043894703f971e083c6e4ed.tar.xz |
Handle any away status from bitlbee as 'invisible' for the server
-rw-r--r-- | facebook/facebook.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/facebook/facebook.c b/facebook/facebook.c index 909b512..b77af1b 100644 --- a/facebook/facebook.c +++ b/facebook/facebook.c @@ -715,6 +715,21 @@ fb_buddy_msg(struct im_connection *ic, char *to, char *message, int flags) return 0; } +static void +fb_set_away(struct im_connection *ic, char *state, char *message) +{ + FbApi *api; + FbData *fata = ic->proto_data; + gboolean invisible; + + api = fb_data_get_api(fata); + invisible = ((state != NULL) && (*state != '\0')); + + if (fb_api_is_invisible(api) != invisible) { + fb_api_connect(api, invisible); + } +} + static int fb_send_typing(struct im_connection *ic, char *who, int flags) { @@ -815,6 +830,18 @@ fb_chat_topic(struct groupchat *gc, char *topic) fb_api_thread_topic(api, tid, topic); } +static GList * +fb_away_states(struct im_connection *ic) +{ + static GList *m = NULL; + + if (G_UNLIKELY(m == NULL)) { + m = g_list_append(m, "Away"); + } + + return m; +} + static account_t * fb_cmd_account(irc_t *irc, char **args, guint required, guint *offset) { @@ -1002,6 +1029,7 @@ init_plugin(void) .login = fb_login, .logout = fb_logout, .buddy_msg = fb_buddy_msg, + .set_away = fb_set_away, .send_typing = fb_send_typing, .add_buddy = fb_add_buddy, .remove_buddy = fb_remove_buddy, @@ -1011,6 +1039,7 @@ init_plugin(void) .chat_msg = fb_chat_msg, .chat_join = fb_chat_join, .chat_topic = fb_chat_topic, + .away_states = fb_away_states, .handle_cmp = g_strcmp0 }; |