Disable broadcast chat by default at compile time

This commit is contained in:
Gioacchino Mazzurco 2018-11-20 15:54:24 +01:00
parent cf94037c10
commit 53f8307bee
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
4 changed files with 25 additions and 6 deletions

View file

@ -848,9 +848,18 @@ bool p3ChatService::handleRecvChatMsgItem(RsChatMsgItem *& ci)
RsServer::notify()->AddPopupMessage(popupChatFlag, ci->PeerId().toStdString(), name, message); /* notify private chat message */ RsServer::notify()->AddPopupMessage(popupChatFlag, ci->PeerId().toStdString(), name, message); /* notify private chat message */
else else
{ {
#ifdef RS_DIRECT_CHAT
/* notify public chat message */ /* notify public chat message */
RsServer::notify()->AddPopupMessage(RS_POPUP_GROUPCHAT, ci->PeerId().toStdString(), "", message); RsServer::notify()->AddPopupMessage(
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_CHAT_NEW, ci->PeerId().toStdString(), message, ""); RS_POPUP_GROUPCHAT,
ci->PeerId().toStdString(), "", message );
RsServer::notify()->AddFeedItem(
RS_FEED_ITEM_CHAT_NEW,
ci->PeerId().toStdString(), message, "" );
#else // def RS_DIRECT_CHAT
/* Ignore deprecated direct node broadcast chat messages */
return false;
#endif
} }
} }

View file

@ -69,9 +69,9 @@ FriendsDialog::FriendsDialog(QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
if (instance == NULL) { if (!instance) instance = this;
instance = this;
} #ifdef RS_DIRECT_CHAT
QString msg = tr("Retroshare broadcast chat: messages are sent to all connected friends."); QString msg = tr("Retroshare broadcast chat: messages are sent to all connected friends.");
// "<font color='grey'>" + DateTime::formatTime(QTime::currentTime()) + "</font> - // "<font color='grey'>" + DateTime::formatTime(QTime::currentTime()) + "</font> -
msg = QString("<font color='blue'><i>" + msg + "</i></font>"); msg = QString("<font color='blue'><i>" + msg + "</i></font>");
@ -82,6 +82,10 @@ FriendsDialog::FriendsDialog(QWidget *parent)
this, SLOT(chatMessageReceived(ChatMessage))); this, SLOT(chatMessageReceived(ChatMessage)));
connect(NotifyQt::getInstance(), SIGNAL(chatStatusChanged(ChatId,QString)), connect(NotifyQt::getInstance(), SIGNAL(chatStatusChanged(ChatId,QString)),
this, SLOT(chatStatusReceived(ChatId,QString))); this, SLOT(chatStatusReceived(ChatId,QString)));
#else // def RS_DIRECT_CHAT
ui.tabWidget->removeTab(ui.tabWidget->indexOf(ui.groupChatTab));
#endif // def RS_DIRECT_CHAT
connect( ui.mypersonalstatusLabel, SIGNAL(clicked()), SLOT(statusmessage())); connect( ui.mypersonalstatusLabel, SIGNAL(clicked()), SLOT(statusmessage()));
connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar())); connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar()));

View file

@ -894,6 +894,7 @@ void NotifyQt::UpdateGUI()
} }
break; break;
case RS_POPUP_GROUPCHAT: case RS_POPUP_GROUPCHAT:
#ifdef RS_DIRECT_CHAT
if ((popupflags & RS_POPUP_GROUPCHAT) && !_disableAllToaster) if ((popupflags & RS_POPUP_GROUPCHAT) && !_disableAllToaster)
{ {
MainWindow *mainWindow = MainWindow::getInstance(); MainWindow *mainWindow = MainWindow::getInstance();
@ -907,6 +908,7 @@ void NotifyQt::UpdateGUI()
} }
toaster = new ToasterItem(new GroupChatToaster(RsPeerId(id), QString::fromUtf8(msg.c_str()))); toaster = new ToasterItem(new GroupChatToaster(RsPeerId(id), QString::fromUtf8(msg.c_str())));
} }
#endif // RS_DIRECT_CHAT
break; break;
case RS_POPUP_CHATLOBBY: case RS_POPUP_CHATLOBBY:
if ((popupflags & RS_POPUP_CHATLOBBY) && !_disableAllToaster) if ((popupflags & RS_POPUP_CHATLOBBY) && !_disableAllToaster)
@ -1041,7 +1043,9 @@ void NotifyQt::testToasters(uint notifyFlags, /*RshareSettings::enumToasterPosit
toaster = new ToasterItem(new ChatToaster(id, message)); toaster = new ToasterItem(new ChatToaster(id, message));
break; break;
case RS_POPUP_GROUPCHAT: case RS_POPUP_GROUPCHAT:
#ifdef RS_DIRECT_CHAT
toaster = new ToasterItem(new GroupChatToaster(id, message)); toaster = new ToasterItem(new GroupChatToaster(id, message));
#endif // RS_DIRECT_CHAT
break; break;
case RS_POPUP_CHATLOBBY: case RS_POPUP_CHATLOBBY:
{ {

View file

@ -322,7 +322,9 @@ void NotifyPage::load()
whileBlocking(ui.popup_NewMsg)->setChecked(notifyflags & RS_POPUP_MSG); whileBlocking(ui.popup_NewMsg)->setChecked(notifyflags & RS_POPUP_MSG);
whileBlocking(ui.popup_DownloadFinished)->setChecked(notifyflags & RS_POPUP_DOWNLOAD); whileBlocking(ui.popup_DownloadFinished)->setChecked(notifyflags & RS_POPUP_DOWNLOAD);
whileBlocking(ui.popup_PrivateChat)->setChecked(notifyflags & RS_POPUP_CHAT); whileBlocking(ui.popup_PrivateChat)->setChecked(notifyflags & RS_POPUP_CHAT);
#ifdef RS_DIRECT_CHAT
whileBlocking(ui.popup_GroupChat)->setChecked(notifyflags & RS_POPUP_GROUPCHAT); whileBlocking(ui.popup_GroupChat)->setChecked(notifyflags & RS_POPUP_GROUPCHAT);
#endif // def RS_DIRECT_CHAT
whileBlocking(ui.popup_ChatLobby)->setChecked(notifyflags & RS_POPUP_CHATLOBBY); whileBlocking(ui.popup_ChatLobby)->setChecked(notifyflags & RS_POPUP_CHATLOBBY);
whileBlocking(ui.popup_ConnectAttempt)->setChecked(notifyflags & RS_POPUP_CONNECT_ATTEMPT); whileBlocking(ui.popup_ConnectAttempt)->setChecked(notifyflags & RS_POPUP_CONNECT_ATTEMPT);