forked from dylex/slack-libpurple
-
Notifications
You must be signed in to change notification settings - Fork 2
/
slack.h
62 lines (46 loc) · 1.66 KB
/
slack.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef _PURPLE_SLACK_H
#define _PURPLE_SLACK_H
#include <string.h>
#include <account.h>
#include "glibcompat.h"
#include "purple-websocket.h"
#include "slack-object.h"
#define SLACK_PLUGIN_ID "prpl-slack"
#define MARK_LIST_END ((SlackObject *)1)
typedef struct _SlackAccount {
PurpleAccount *account;
PurpleConnection *gc;
char *api_url; /* e.g., "https://slack.com/api" */
char *token; /* url encoded */
short login_step;
PurpleWebsocket *rtm;
guint rtm_id;
GHashTable *rtm_call; /* unsigned rtm_id -> SlackRTMCall */
struct _SlackTeam {
char *id;
char *name;
char *domain;
} team;
struct _SlackUser *self;
GHashTable *users; /* slack_object_id user_id -> SlackUser (ref) */
GHashTable *user_names; /* char *user_name -> SlackUser (no ref) */
GHashTable *ims; /* slack_object_id im_id -> SlackUser (no ref) */
GHashTable *channels; /* slack_object_id channel_id -> SlackChannel (ref) */
GHashTable *channel_names; /* char *chan_name -> SlackChannel (no ref) */
int cid;
GHashTable *channel_cids; /* int purple_chat_id -> SlackChannel (no ref) */
PurpleGroup *blist; /* default group for ims/channels */
GHashTable *buddies; /* char *slack_id -> PurpleBListNode */
PurpleRoomlist *roomlist;
guint mark_timer;
SlackObject *mark_list;
GQueue *avatar_queue; /* Queue for avatar downloads */
} SlackAccount;
void slack_login_step(SlackAccount *sa);
GHashTable *slack_chat_info_defaults(PurpleConnection *gc, const char *name);
static inline SlackAccount *get_slack_account(PurpleAccount *account) {
if (!account || !account->gc || strcmp(account->protocol_id, SLACK_PLUGIN_ID))
return NULL;
return account->gc->proto_data;
}
#endif // _PURPLE_SLACK_H