diff --git a/README.md b/README.md
index dd78dae..4ea7a66 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Toxic is a [Tox](https://tox.im)-based instant messenging client which formerly
[![Toxic Screenshot](https://i.imgur.com/san99Z2.png "Home Screen")](https://i.imgur.com/san99Z2.png)
## Installation
-[Use our repositories](https://wiki.tox.im/Binaries#Linux)
+[Use our repositories](https://wiki.tox.chat/Binaries#Linux)
[Compile it yourself](/INSTALL.md)
## Downloads
diff --git a/src/group_commands.c b/src/group_commands.c
index 4816bcb..e354e68 100644
--- a/src/group_commands.c
+++ b/src/group_commands.c
@@ -22,7 +22,6 @@
#include
#include
-
#include "toxic.h"
#include "windows.h"
#include "line_info.h"
diff --git a/src/groupchat.c b/src/groupchat.c
index 6530e9c..0c896ce 100644
--- a/src/groupchat.c
+++ b/src/groupchat.c
@@ -419,10 +419,72 @@ static void groupchat_onGroupTopicChange(ToxWindow *self, Tox *m, uint32_t group
line_info_add(self, timefrmt, NULL, NULL, SYS_MSG, 1, MAGENTA, "-!- %s set the topic to: %s", nick, topic);
char tmp_event[MAX_STR_SIZE];
- snprintf(tmp_event, sizeof(tmp_event), " set the group topic to %s", topic);
+ snprintf(tmp_event, sizeof(tmp_event), " set the topic to %s", topic);
write_to_log(tmp_event, nick, ctx->log, true);
}
+static void groupchat_onGroupPeerLimit(ToxWindow *self, Tox *m, uint32_t groupnumber, uint32_t peer_limit)
+{
+ ChatContext *ctx = self->chatwin;
+
+ if (self->num != groupnumber)
+ return;
+
+ char timefrmt[TIME_STR_SIZE];
+ get_time_str(timefrmt, sizeof(timefrmt));
+
+ line_info_add(self, timefrmt, NULL, NULL, SYS_MSG, 1, BLUE, "-!- The group founder has set the peer limit to %d", peer_limit);
+
+ char tmp_event[MAX_STR_SIZE];
+ snprintf(tmp_event, sizeof(tmp_event), " set the peer limit to %d", peer_limit);
+ write_to_log(tmp_event, "The founder", ctx->log, true);
+}
+
+static void groupchat_onGroupPrivacyState(ToxWindow *self, Tox *m, uint32_t groupnumber, TOX_GROUP_PRIVACY_STATE state)
+{
+ ChatContext *ctx = self->chatwin;
+
+ if (self->num != groupnumber)
+ return;
+
+ const char *state_str = state == TOX_GROUP_PRIVACY_STATE_PUBLIC ? "public" : "private";
+
+ char timefrmt[TIME_STR_SIZE];
+ get_time_str(timefrmt, sizeof(timefrmt));
+
+ line_info_add(self, timefrmt, NULL, NULL, SYS_MSG, 1, BLUE, "-!- The group founder has set the group to %s.", state_str);
+
+ char tmp_event[MAX_STR_SIZE];
+ snprintf(tmp_event, sizeof(tmp_event), " set the group to %s.", state_str);
+ write_to_log(tmp_event, "The founder", ctx->log, true);
+}
+
+static void groupchat_onGroupPassword(ToxWindow *self, Tox *m, uint32_t groupnumber, const char *password,
+ size_t length)
+{
+ ChatContext *ctx = self->chatwin;
+
+ if (self->num != groupnumber)
+ return;
+
+ char timefrmt[TIME_STR_SIZE];
+ get_time_str(timefrmt, sizeof(timefrmt));
+
+ if (length > 0) {
+ line_info_add(self, timefrmt, NULL, NULL, SYS_MSG, 1, BLUE, "-!- The group founder has password protected the group.");
+
+ char tmp_event[MAX_STR_SIZE];
+ snprintf(tmp_event, sizeof(tmp_event), " set a new password.");
+ write_to_log(tmp_event, "The founder", ctx->log, true);
+ } else {
+ line_info_add(self, timefrmt, NULL, NULL, SYS_MSG, 1, BLUE, "-!- The group founder has removed password protection.");
+
+ char tmp_event[MAX_STR_SIZE];
+ snprintf(tmp_event, sizeof(tmp_event), " removed password protection.");
+ write_to_log(tmp_event, "The founder", ctx->log, true);
+ }
+}
+
/* Copies peer names/lengths */
static void copy_peernames(int gnum, uint8_t peerlist[][TOX_MAX_NAME_LENGTH], uint16_t lengths[], int npeers)
{
@@ -1055,6 +1117,9 @@ ToxWindow new_group_chat(Tox *m, uint32_t groupnum, const char *groupname, int l
ret.onGroupPeerJoin = &groupchat_onGroupPeerJoin;
ret.onGroupPeerExit = &groupchat_onGroupPeerExit;
ret.onGroupTopicChange = &groupchat_onGroupTopicChange;
+ ret.onGroupPeerLimit = &groupchat_onGroupPeerLimit;
+ ret.onGroupPrivacyState = &groupchat_onGroupPrivacyState;
+ ret.onGroupPassword = &groupchat_onGroupPassword;
ret.onGroupNickChange = &groupchat_onGroupNickChange;
ret.onGroupSelfJoin = &groupchat_onGroupSelfJoin;
ret.onGroupRejected = &groupchat_onGroupRejected;
diff --git a/src/toxic.c b/src/toxic.c
index f203297..5680258 100644
--- a/src/toxic.c
+++ b/src/toxic.c
@@ -575,11 +575,9 @@ static void init_tox_callbacks(Tox *m)
tox_callback_group_peer_exit(m, on_group_peer_exit, NULL);
tox_callback_group_peer_name(m, on_group_nick_change, NULL);
tox_callback_group_topic(m, on_group_topic_change, NULL);
-
- // tox_callback_group_peer_limit(m, on_group_peer_limit, NULL);
- // tox_callback_group_privacy_state(m, on_group_privacy_state, NULL);
- // tox_callback_group_password(m, on_group_password, NULL);
-
+ tox_callback_group_peer_limit(m, on_group_peer_limit, NULL);
+ tox_callback_group_privacy_state(m, on_group_privacy_state, NULL);
+ tox_callback_group_password(m, on_group_password, NULL);
tox_callback_group_self_join(m, on_group_self_join, NULL);
tox_callback_group_join_fail(m, on_group_rejected, NULL);
tox_callback_group_moderation(m, on_group_moderation, NULL);
diff --git a/src/toxic.h b/src/toxic.h
index 0388167..6ac78cc 100644
--- a/src/toxic.h
+++ b/src/toxic.h
@@ -123,6 +123,9 @@ void on_group_namelistchange(Tox *m, uint32_t groupnumber, void *userdata);
void on_group_peer_join(Tox *m, uint32_t groupnumber, uint32_t peernumber, void *userdata);
void on_group_peer_exit(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *partmsg, size_t length, void *userdata);
void on_group_topic_change(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *topic, size_t length, void *userdata);
+void on_group_peer_limit(Tox *m, uint32_t groupnumber, uint32_t peer_limit, void *userdata);
+void on_group_privacy_state(Tox *m, uint32_t groupnumber, TOX_GROUP_PRIVACY_STATE privacy_state, void *userdata);
+void on_group_password(Tox *m, uint32_t groupnumber, const uint8_t *password, size_t length, void *userdata);
void on_group_nick_change(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *newname, size_t length, void *userdata);
void on_group_self_join(Tox *m, uint32_t groupnumber, void *userdata);
void on_group_rejected(Tox *m, uint32_t groupnumber, TOX_GROUP_JOIN_FAIL type, void *userdata);
diff --git a/src/windows.c b/src/windows.c
index 14174ad..8d5d58c 100644
--- a/src/windows.c
+++ b/src/windows.c
@@ -243,6 +243,36 @@ void on_group_topic_change(Tox *m, uint32_t groupnumber, uint32_t peernumber, co
}
}
+void on_group_peer_limit(Tox *m, uint32_t groupnumber, uint32_t peer_limit, void *userdata)
+{
+ size_t i;
+
+ for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
+ if (windows[i].onGroupPeerLimit != NULL)
+ windows[i].onGroupPeerLimit(&windows[i], m, groupnumber, peer_limit);
+ }
+}
+
+void on_group_privacy_state(Tox *m, uint32_t groupnumber, TOX_GROUP_PRIVACY_STATE privacy_state, void *userdata)
+{
+ size_t i;
+
+ for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
+ if (windows[i].onGroupPrivacyState != NULL)
+ windows[i].onGroupPrivacyState(&windows[i], m, groupnumber, privacy_state);
+ }
+}
+
+void on_group_password(Tox *m, uint32_t groupnumber, const uint8_t *password, size_t length, void *userdata)
+{
+ size_t i;
+
+ for (i = 0; i < MAX_WINDOWS_NUM; ++i) {
+ if (windows[i].onGroupPassword != NULL)
+ windows[i].onGroupPassword(&windows[i], m, groupnumber, (char *) password, length);
+ }
+}
+
void on_group_nick_change(Tox *m, uint32_t groupnumber, uint32_t peernumber, const uint8_t *newname, size_t length,
void *userdata)
{
diff --git a/src/windows.h b/src/windows.h
index deb5e11..9e93d69 100644
--- a/src/windows.h
+++ b/src/windows.h
@@ -136,6 +136,9 @@ struct ToxWindow {
void(*onGroupPeerExit)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t);
void(*onGroupNickChange)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t);
void(*onGroupTopicChange)(ToxWindow *, Tox *, uint32_t, uint32_t, const char *, size_t);
+ void(*onGroupPeerLimit)(ToxWindow *, Tox *, uint32_t, uint32_t);
+ void(*onGroupPrivacyState)(ToxWindow *, Tox *, uint32_t, TOX_GROUP_PRIVACY_STATE);
+ void(*onGroupPassword)(ToxWindow *, Tox *, uint32_t, const char *, size_t);
void(*onGroupSelfJoin)(ToxWindow *, Tox *, uint32_t);
void(*onGroupRejected)(ToxWindow *, Tox *, uint32_t, TOX_GROUP_JOIN_FAIL);
void(*onGroupModeration)(ToxWindow *, Tox *, uint32_t, uint32_t, uint32_t, TOX_GROUP_MOD_EVENT);