Changeset a33ee0f for protocols


Ignore:
Timestamp:
2016-09-20T03:39:05Z (8 years ago)
Author:
jgeboski <jgeboski@…>
Branches:
master
Children:
725f942
Parents:
67ea361
git-author:
jgeboski <jgeboski@…> (22-06-16 18:54:52)
git-committer:
jgeboski <jgeboski@…> (20-09-16 03:39:05)
Message:

Added an interface for the listing of existing chatrooms

Several protocols can provide a list of existing chatrooms that a user
is able join. This is crucial for the usage of several protocols, most
notably Purple and Facebook.

Plugins wishing to support this extended functionality must implement
the new prpl->chat_list() function. This implemented function will in
most cases send a remote request for the list of chatrooms. Once the
list of chatrooms is obtained, a bee_chat_info_t GSList must be created
and assigned to the im_connection->chatlist field. Then a call to the
bee_chat_list_finish() is needed to display the list to the user.

The chat list is maintained entirely by the plugin, so it is important
to ensure all pointers related to the chat list remain valid until the
chat list is set to NULL. This list is used internally by bitlbee to
calculate indexes, which then allows the user to join a chat with an
index, rather than some random identifier. It also important to ensure
the list is properly freed whenever it is updated, or when the account
is disconnect via the prpl->logout() function.

On the user interface side of things, the 'chat list' subcommand was
recommissioned. For a user to list the existing chat rooms:

chat list <account id>

Afterwards a user can join a chatroom in the list with its index. This
extends the functionality of the 'chat add' subcommand by adding in
support for the exclamation point operator to denote an index.

chat add <account id> !<index> [channel]

Location:
protocols
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/bee.h

    r67ea361 ra33ee0f  
    8383        void *data; /* Can be used by the IM module. */
    8484} bee_user_t;
     85
     86typedef struct bee_chat_info {
     87        char *title;
     88        char *topic;
     89} bee_chat_info_t;
    8590
    8691/* This one's mostly used so save space and make it easier (cheaper) to
     
    185190G_MODULE_EXPORT void imcb_chat_invite(struct im_connection *ic, const char *name, const char *who, const char *msg);
    186191
     192G_MODULE_EXPORT void bee_chat_list_finish(struct im_connection *ic);
     193
    187194#endif /* __BEE_H__ */
  • protocols/bee_chat.c

    r67ea361 ra33ee0f  
    274274        }
    275275}
     276
     277void bee_chat_list_finish(struct im_connection *ic)
     278{
     279        cmd_chat_list_finish(ic);
     280}
  • protocols/nogaim.h

    r67ea361 ra33ee0f  
    9696
    9797        GSList *groupchats;
     98        GSList *chatlist;
    9899};
    99100
     
    263264        gboolean (* handle_is_self) (struct im_connection *, const char *who);
    264265
     266        /* This sets/updates the im_connection->chatlist field with a
     267         * bee_chat_info_t GSList. This function should ensure the
     268         * bee_chat_list_finish() function gets called at some point
     269         * after the chat list is completely updated.
     270         */
     271        void (* chat_list) (struct im_connection *, const char *server);
     272
    265273        /* Some placeholders so eventually older plugins may cooperate with newer BitlBees. */
    266274        void *resv1;
Note: See TracChangeset for help on using the changeset viewer.