1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Ask before joining group

Fixes #1101, closes #1177
This commit is contained in:
Dubslow 2015-02-15 17:24:42 -06:00
parent a930b398d4
commit dcf87f7475
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA

View File

@ -37,6 +37,7 @@
#include "src/platform/timer.h"
#include "systemtrayicon.h"
#include "src/nexus.h"
#include "src/widget/gui.h"
#include "src/offlinemsgengine.h"
#include <cassert>
#include <QMessageBox>
@ -855,6 +856,8 @@ void Widget::copyFriendIdToClipboard(int friendId)
void Widget::onGroupInviteReceived(int32_t friendId, uint8_t type, QByteArray invite)
{
if (type == TOX_GROUPCHAT_TYPE_TEXT || type == TOX_GROUPCHAT_TYPE_AV)
{
if (GUI::askQuestion(tr("Group invite", "popup title"), tr("%1 has invited you to a groupchat. Would you like to join?", "popup text").arg(Nexus::getCore()->getFriendUsername(friendId))))
{
int groupId = Nexus::getCore()->joinGroupchat(friendId, type, (uint8_t*)invite.data(), invite.length());
if (groupId < 0)
@ -863,6 +866,7 @@ void Widget::onGroupInviteReceived(int32_t friendId, uint8_t type, QByteArray in
return;
}
}
}
else
{
qWarning() << "Widget::onGroupInviteReceived: Unknown groupchat type:"<<type;