Skip to content

Commit

Permalink
Add support for setting mood messages
Browse files Browse the repository at this point in the history
  • Loading branch information
EionRobb committed Jul 14, 2016
1 parent 5084a3e commit b2c3457
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
22 changes: 22 additions & 0 deletions skypeweb/skypeweb_contacts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1430,3 +1430,25 @@ skypeweb_buddy_unblock(PurpleConnection *pc, const char *name)

g_free(url);
}


void
skypeweb_set_mood_message(SkypeWebAccount *sa, const gchar *mood)
{
JsonObject *obj, *payload;
gchar *post;

g_return_if_fail(mood);

obj = json_object_new();
payload = json_object_new();

json_object_set_string_member(payload, "mood", mood);
json_object_set_object_member(obj, "payload", payload);
post = skypeweb_jsonobj_to_string(obj);

skypeweb_post_or_get(sa, SKYPEWEB_METHOD_POST | SKYPEWEB_METHOD_SSL, SKYPEWEB_CONTACTS_HOST, "/users/self/profile/partial", post, NULL, NULL, TRUE);

g_free(post);
json_object_unref(obj);
}
2 changes: 2 additions & 0 deletions skypeweb/skypeweb_contacts.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ void skypeweb_buddy_unblock(PurpleConnection *pc, const char *name);

gboolean skypeweb_check_authrequests(SkypeWebAccount *sa);

void skypeweb_set_mood_message(SkypeWebAccount *sa, const gchar *mood);

#endif /* SKYPEWEB_CONTACTS_H */
1 change: 1 addition & 0 deletions skypeweb/skypeweb_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ skypeweb_set_status(PurpleAccount *account, PurpleStatus *status)
SkypeWebAccount *sa = purple_connection_get_protocol_data(pc);

skypeweb_set_statusid(sa, purple_status_get_id(status));
skypeweb_set_mood_message(sa, purple_status_get_attr_string(status, "message"));
}

void
Expand Down

0 comments on commit b2c3457

Please sign in to comment.