mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-07 22:02:32 -04:00
added consistent detection of time-shift in chat lobbies. Shows a warning when the shift is larger than 2^9 seconds (approx. 10 minutes. Warning shown only once).
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6242 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a850b18be2
commit
7f53f0e0cc
6 changed files with 95 additions and 0 deletions
|
@ -446,6 +446,32 @@ void NotifyQt::notifyCustomState(const std::string& peer_id, const std::string&
|
|||
emit peerHasNewCustomStateString(QString::fromStdString(peer_id), QString::fromUtf8(status_string.c_str())) ;
|
||||
}
|
||||
|
||||
void NotifyQt::notifyChatLobbyTimeShift(int shift)
|
||||
{
|
||||
{
|
||||
QMutexLocker m(&_mutex) ;
|
||||
if(!_enabled)
|
||||
return ;
|
||||
}
|
||||
|
||||
#ifdef NOTIFY_DEBUG
|
||||
std::cerr << "notifyQt: Received chat lobby time shift message: shift = " << shift << std::endl;
|
||||
#endif
|
||||
emit chatLobbyTimeShift(shift) ;
|
||||
}
|
||||
void NotifyQt::handleChatLobbyTimeShift(int shift)
|
||||
{
|
||||
static bool already = false ;
|
||||
|
||||
if(!already)
|
||||
{
|
||||
QString string = tr("For the chat lobbies to work properly, the time of your computer needs to be correct. Please check that this is the case (A possible time shift of ")+QString::number(shift)+tr(" seconds with your friends was detected). ") ;
|
||||
|
||||
QMessageBox::warning(NULL,tr("Please check your system clock."),string) ;
|
||||
already = true ;
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyQt::notifyChatLobbyEvent(uint64_t lobby_id,uint32_t event_type,const std::string& nickname,const std::string& str)
|
||||
{
|
||||
{
|
||||
|
|
|
@ -46,6 +46,8 @@ class NotifyQt: public QObject, public NotifyBase
|
|||
virtual void notifyPeerHasNewAvatar(std::string peer_id) ;
|
||||
virtual void notifyOwnAvatarChanged() ;
|
||||
virtual void notifyChatLobbyEvent(uint64_t /* lobby id */,uint32_t /* event type */,const std::string& /*nickname*/,const std::string& /* any string */) ;
|
||||
virtual void notifyChatLobbyTimeShift(int time_shift) ;
|
||||
|
||||
virtual void notifyOwnStatusMessageChanged() ;
|
||||
virtual void notifyDiskFull(uint32_t loc,uint32_t size_in_mb) ;
|
||||
/* peer has changed the state */
|
||||
|
@ -122,6 +124,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||
void historyChanged(uint msgId, int type);
|
||||
void chatLobbyInviteReceived() ;
|
||||
void deferredSignatureHandlingRequested() ;
|
||||
void chatLobbyTimeShift(int time_shift) ;
|
||||
|
||||
/* Notify from GUI */
|
||||
void chatStyleChanged(int /*ChatStyle::enumStyleType*/ styleType);
|
||||
|
@ -133,6 +136,7 @@ class NotifyQt: public QObject, public NotifyBase
|
|||
private slots:
|
||||
void runningTick();
|
||||
void handleSignatureEvent() ;
|
||||
void handleChatLobbyTimeShift(int) ;
|
||||
|
||||
private:
|
||||
NotifyQt();
|
||||
|
|
|
@ -325,6 +325,7 @@ int main(int argc, char *argv[])
|
|||
std::cerr << "connecting signals and slots" << std::endl ;
|
||||
QObject::connect(notify,SIGNAL(gotTurtleSearchResult(qulonglong,FileDetail)),w->transfersDialog->searchDialog ,SLOT(updateFiles(qulonglong,FileDetail))) ;
|
||||
QObject::connect(notify,SIGNAL(deferredSignatureHandlingRequested()),notify,SLOT(handleSignatureEvent()),Qt::QueuedConnection) ;
|
||||
QObject::connect(notify,SIGNAL(chatLobbyTimeShift(int)),notify,SLOT(handleChatLobbyTimeShift(int)),Qt::QueuedConnection) ;
|
||||
QObject::connect(notify,SIGNAL(diskFull(int,int)) ,w ,SLOT(displayDiskSpaceWarning(int,int))) ;
|
||||
QObject::connect(notify,SIGNAL(filesPreModChanged(bool)) ,w->transfersDialog->localSharedFiles ,SLOT(preModDirectories(bool) )) ;
|
||||
QObject::connect(notify,SIGNAL(filesPreModChanged(bool)) ,w->transfersDialog->remoteSharedFiles ,SLOT(preModDirectories(bool) )) ;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue