2014-02-25 08:28:24 +01:00
|
|
|
/* groupchat.h
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Toxic All Rights Reserved.
|
|
|
|
*
|
|
|
|
* This file is part of Toxic.
|
|
|
|
*
|
|
|
|
* Toxic is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Toxic is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Toxic. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
2013-09-15 22:38:38 +02:00
|
|
|
*/
|
|
|
|
|
2014-09-23 03:24:45 +02:00
|
|
|
#ifndef GROUPCHAT_H
|
|
|
|
#define GROUPCHAT_H
|
2014-06-12 00:06:55 +02:00
|
|
|
|
|
|
|
#include "toxic.h"
|
|
|
|
#include "windows.h"
|
2014-11-26 18:24:52 +01:00
|
|
|
|
2013-11-24 03:19:59 +01:00
|
|
|
#define SIDEBAR_WIDTH 16
|
2013-12-03 09:44:02 +01:00
|
|
|
#define SDBAR_OFST 2 /* Offset for the peer number box at the top of the statusbar */
|
2014-06-19 19:50:41 +02:00
|
|
|
#define MAX_GROUPCHAT_NUM MAX_WINDOWS_NUM - 2
|
2014-11-29 15:36:31 +01:00
|
|
|
#define GROUP_EVENT_WAIT 3
|
2013-11-24 03:19:59 +01:00
|
|
|
|
2015-07-16 23:10:04 +02:00
|
|
|
struct GroupPeer {
|
2015-09-01 08:29:25 +02:00
|
|
|
bool active;
|
2015-07-16 23:10:04 +02:00
|
|
|
char name[TOX_MAX_NAME_LENGTH];
|
|
|
|
size_t name_length;
|
2015-09-01 08:29:25 +02:00
|
|
|
uint32_t peer_id;
|
2015-07-16 23:10:04 +02:00
|
|
|
TOX_USER_STATUS status;
|
|
|
|
TOX_GROUP_ROLE role;
|
2014-11-29 15:36:31 +01:00
|
|
|
};
|
2014-11-15 02:13:08 +01:00
|
|
|
|
2013-11-24 03:19:59 +01:00
|
|
|
typedef struct {
|
2015-07-16 23:10:04 +02:00
|
|
|
struct GroupPeer *peer_list;
|
|
|
|
char *name_list; /* List of peer names, needed for tab completion */
|
2015-09-01 08:29:25 +02:00
|
|
|
uint32_t num_peers; /* Number of peers in the chat/name_list array */
|
|
|
|
uint32_t max_idx; /* Maximum peer list index - 1 */
|
2015-07-16 23:10:04 +02:00
|
|
|
uint32_t groupnumber;
|
|
|
|
int chatwin;
|
|
|
|
bool active;
|
2015-09-01 08:29:25 +02:00
|
|
|
uint64_t time_connected; /* The time we successfully connected to the group */
|
|
|
|
int side_pos; /* current position of the sidebar - used for scrolling up and down */
|
2013-11-24 03:19:59 +01:00
|
|
|
} GroupChat;
|
|
|
|
|
2015-07-14 04:12:13 +02:00
|
|
|
void close_groupchat(ToxWindow *self, Tox *m, uint32_t groupnum);
|
|
|
|
int init_groupchat_win(Tox *m, uint32_t groupnum, const char *groupname, size_t length);
|
|
|
|
void set_nick_all_groups(Tox *m, const char *nick, size_t length);
|
2015-01-11 22:48:40 +01:00
|
|
|
void set_status_all_groups(Tox *m, uint8_t status);
|
2015-09-01 08:29:25 +02:00
|
|
|
int group_get_nick_peer_id(uint32_t groupnum, const char *nick, uint32_t *peer_id);
|
2014-10-08 08:45:08 +02:00
|
|
|
|
2015-07-16 23:10:04 +02:00
|
|
|
/* destroys and re-creates groupchat window */
|
2014-10-08 08:45:08 +02:00
|
|
|
void redraw_groupchat_win(ToxWindow *self);
|
|
|
|
|
2014-09-23 03:24:45 +02:00
|
|
|
#endif /* #define GROUPCHAT_H */
|