2018-05-09 04:39:16 +00:00
|
|
|
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
// License, version 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2018-04-29 21:26:14 +00:00
|
|
|
#ifndef _SLACK_WORKSPACE_H_
|
|
|
|
#define _SLACK_WORKSPACE_H_
|
|
|
|
|
2018-05-13 14:31:23 +00:00
|
|
|
#define SLACK_WORKSPACE_EMOJI_SHORTNAME_MAX_LEN 1 + 100 + 1
|
|
|
|
|
2018-04-29 21:26:14 +00:00
|
|
|
extern struct t_slack_workspace *slack_workspaces;
|
|
|
|
extern struct t_slack_workspace *last_slack_workspace;
|
|
|
|
|
2018-05-13 14:31:23 +00:00
|
|
|
struct t_slack_workspace_emoji
|
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
char *url;
|
|
|
|
|
|
|
|
struct t_slack_workspace_emoji *prev_emoji;
|
|
|
|
struct t_slack_workspace_emoji *next_emoji;
|
|
|
|
};
|
|
|
|
|
2018-04-29 21:26:14 +00:00
|
|
|
enum t_slack_workspace_option
|
|
|
|
{
|
2018-05-06 00:09:58 +00:00
|
|
|
SLACK_WORKSPACE_OPTION_TOKEN,
|
2018-04-29 21:26:14 +00:00
|
|
|
SLACK_WORKSPACE_NUM_OPTIONS,
|
|
|
|
};
|
|
|
|
|
2018-05-01 10:23:37 +00:00
|
|
|
struct t_json_chunk
|
|
|
|
{
|
|
|
|
char *data;
|
|
|
|
struct t_json_chunk *next;
|
|
|
|
};
|
|
|
|
|
2018-04-29 21:26:14 +00:00
|
|
|
struct t_slack_workspace
|
|
|
|
{
|
2018-05-01 10:23:37 +00:00
|
|
|
char *id;
|
2018-04-29 21:26:14 +00:00
|
|
|
char *name;
|
2018-05-01 10:23:37 +00:00
|
|
|
char *domain;
|
2018-04-29 21:26:14 +00:00
|
|
|
struct t_config_option *options[SLACK_WORKSPACE_NUM_OPTIONS];
|
|
|
|
|
|
|
|
int reloading_from_config;
|
|
|
|
int reloaded_from_config;
|
|
|
|
|
|
|
|
int is_connected;
|
2018-05-01 10:23:37 +00:00
|
|
|
int disconnected;
|
|
|
|
|
2018-05-02 15:55:41 +00:00
|
|
|
int idx;
|
2018-05-01 10:23:37 +00:00
|
|
|
char *uri;
|
|
|
|
char *ws_url;
|
|
|
|
struct lws *client_wsi;
|
|
|
|
struct lws_context *context;
|
|
|
|
struct t_json_chunk *json_chunks;
|
2018-05-02 07:11:57 +00:00
|
|
|
struct t_slack_request *requests;
|
2018-05-02 15:55:41 +00:00
|
|
|
struct t_slack_request *last_request;
|
2018-05-01 10:23:37 +00:00
|
|
|
|
|
|
|
char *user;
|
|
|
|
char *nick;
|
2018-04-29 21:26:14 +00:00
|
|
|
|
2018-05-01 10:23:37 +00:00
|
|
|
struct t_gui_buffer *buffer;
|
|
|
|
char *buffer_as_string;
|
2018-05-02 07:11:57 +00:00
|
|
|
struct t_slack_user *users;
|
|
|
|
struct t_slack_user *last_user;
|
|
|
|
struct t_slack_channel *channels;
|
|
|
|
struct t_slack_channel *last_channel;
|
2018-05-13 14:31:23 +00:00
|
|
|
struct t_slack_workspace_emoji *emoji;
|
|
|
|
struct t_slack_workspace_emoji *last_emoji;
|
2018-04-29 21:26:14 +00:00
|
|
|
struct t_slack_workspace *prev_workspace;
|
|
|
|
struct t_slack_workspace *next_workspace;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern char *slack_workspace_options[][2];
|
|
|
|
|
2018-05-01 10:23:37 +00:00
|
|
|
struct t_slack_workspace *slack_workspace_search(const char *workspace_domain);
|
|
|
|
struct t_slack_workspace *slack_workspace_casesearch (const char *workspace_domain);
|
2018-04-29 21:26:14 +00:00
|
|
|
int slack_workspace_search_option(const char *option_name);
|
2018-05-01 10:23:37 +00:00
|
|
|
struct t_slack_workspace *slack_workspace_alloc(const char *domain);
|
|
|
|
void slack_workspace_free_data(struct t_slack_workspace *workspace);
|
|
|
|
void slack_workspace_free(struct t_slack_workspace *workspace);
|
|
|
|
void slack_workspace_free_all();
|
|
|
|
void slack_workspace_disconnect(struct t_slack_workspace *workspace,
|
2018-05-02 22:16:20 +00:00
|
|
|
int reconnect);
|
2018-05-01 10:23:37 +00:00
|
|
|
void slack_workspace_disconnect_all();
|
|
|
|
void slack_workspace_close_connection(struct t_slack_workspace *workspace);
|
|
|
|
int slack_workspace_connect(struct t_slack_workspace *workspace);
|
|
|
|
int slack_workspace_timer_cb(const void *pointer, void *data, int remaining_calls);
|
2018-05-02 07:11:57 +00:00
|
|
|
void slack_workspace_register_request(struct t_slack_workspace *workspace,
|
|
|
|
struct t_slack_request *request);
|
2018-05-13 14:31:23 +00:00
|
|
|
struct t_slack_workspace_emoji *slack_workspace_emoji_search(
|
|
|
|
struct t_slack_workspace *workspace,
|
|
|
|
const char *name);
|
|
|
|
struct t_slack_workspace_emoji *slack_workspace_add_emoji(
|
|
|
|
struct t_slack_workspace *workspace,
|
|
|
|
const char *name, const char *url);
|
2018-04-29 21:26:14 +00:00
|
|
|
|
|
|
|
#endif /*SLACK_WORKSPACE_H*/
|