Ignore:
Timestamp:
2015-05-24T19:43:09Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Children:
a852b2b
Parents:
93e0901
Message:

imcb_get_local_contacts() so an IM plugin can request the local contact list
before finishing login. Makes sense since processing the contact list can be
a major part of the login process.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/rpc/rpc.c

    r93e0901 r8c3637b  
    605605}
    606606
     607static JSON_Value *rpc_imcb_get_local_contacts(struct im_connection *ic, void *func_, JSON_Array *params) {
     608        JSON_Value *resp = json_value_init_object();
     609        JSON_Value *arr = json_value_init_array();
     610        GSList *contacts = imcb_get_local_contacts(ic);
     611        GSList *c;
     612        for (c = contacts; c; c = c->next) {
     613                json_array_append_string(json_array(arr), (const char*) c->data);
     614        }
     615        g_slist_free(contacts);
     616        json_object_set_value(json_object(resp), "result", arr);
     617        return resp;
     618}
     619
    607620static JSON_Value *rpc_imcb_chat_new(struct im_connection *ic, void *func_, JSON_Array *params) {
    608621        struct rpc_groupchat *rc = rpc_groupchat_new(ic, json_array_get_string(params, 0));
     
    719732        { "imcb_buddy_msg", imcb_buddy_msg, rpc_imcb_buddy_msg, "ssii" },
    720733        { "imcb_buddy_typing", imcb_buddy_typing, rpc_imcb_buddy_typing, "si" },
     734        { "imcb_get_local_contacts", NULL, rpc_imcb_get_local_contacts, "" },
    721735        { "imcb_chat_new", NULL, rpc_imcb_chat_new, "s" },
    722736       
Note: See TracChangeset for help on using the changeset viewer.