From 8637d3cb31dc18a65363f082ee992e2e5ccc0c61 Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 13 Feb 2016 16:15:41 +0100 Subject: [PATCH 1/3] Fixed issue #263 --- retroshare-gui/src/gui/common/Emoticons.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/common/Emoticons.cpp b/retroshare-gui/src/gui/common/Emoticons.cpp index 6e03aed4a..d905c5559 100644 --- a/retroshare-gui/src/gui/common/Emoticons.cpp +++ b/retroshare-gui/src/gui/common/Emoticons.cpp @@ -73,7 +73,7 @@ void Emoticons::load() int i = 0; QString smcode; QString smfile; - while(sm_codes[i] != '{') + while(i < sm_codes.length() && sm_codes[i] != '{') { ++i; } From 63a8260cb9ff2e24d41ada4f6793a0fecd4b4abc Mon Sep 17 00:00:00 2001 From: electron128 Date: Sun, 14 Feb 2016 11:53:27 +0100 Subject: [PATCH 2/3] change RsNotify to use RsGxsId for chat lobby events --- libretroshare/src/chat/distributedchat.cc | 4 ++-- libretroshare/src/pqi/p3notify.cc | 2 +- libretroshare/src/pqi/p3notify.h | 2 +- libretroshare/src/retroshare/rsnotify.h | 2 +- retroshare-gui/src/gui/ChatLobbyWidget.cpp | 6 +++--- retroshare-gui/src/gui/ChatLobbyWidget.h | 2 +- retroshare-gui/src/gui/notifyqt.cpp | 5 +++-- retroshare-gui/src/gui/notifyqt.h | 4 ++-- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/libretroshare/src/chat/distributedchat.cc b/libretroshare/src/chat/distributedchat.cc index fb2a8a419..76d0edade 100644 --- a/libretroshare/src/chat/distributedchat.cc +++ b/libretroshare/src/chat/distributedchat.cc @@ -768,7 +768,7 @@ void DistributedChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem * #endif } } - RsServer::notify()->notifyChatLobbyEvent(item->lobby_id,item->event_type,item->signature.keyId.toStdString(),item->string1) ; + RsServer::notify()->notifyChatLobbyEvent(item->lobby_id,item->event_type,item->signature.keyId,item->string1) ; } void DistributedChatService::getListOfNearbyChatLobbies(std::vector& visible_lobbies) { @@ -1834,7 +1834,7 @@ void DistributedChatService::cleanLobbyCaches() // update the gui for(std::list::const_iterator it(changed_lobbies.begin());it!=changed_lobbies.end();++it) - RsServer::notify()->notifyChatLobbyEvent(*it,RS_CHAT_LOBBY_EVENT_KEEP_ALIVE,"","") ; + RsServer::notify()->notifyChatLobbyEvent(*it,RS_CHAT_LOBBY_EVENT_KEEP_ALIVE,RsGxsId(),"") ; // send connection challenges // diff --git a/libretroshare/src/pqi/p3notify.cc b/libretroshare/src/pqi/p3notify.cc index fce9a80ed..a8102dc0e 100644 --- a/libretroshare/src/pqi/p3notify.cc +++ b/libretroshare/src/pqi/p3notify.cc @@ -217,7 +217,7 @@ bool p3Notify::ClearFeedItems(uint32_t type) #define FOR_ALL_NOTIFY_CLIENTS for(std::list::const_iterator it(notifyClients.begin());it!=notifyClients.end();++it) -void p3Notify::notifyChatLobbyEvent(uint64_t lobby_id, uint32_t event_type,const std::string& nickname,const std::string& any_string) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatLobbyEvent(lobby_id,event_type,nickname,any_string) ; } +void p3Notify::notifyChatLobbyEvent(uint64_t lobby_id, uint32_t event_type,const RsGxsId& nickname,const std::string& any_string) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatLobbyEvent(lobby_id,event_type,nickname,any_string) ; } void p3Notify::notifyListPreChange(int list, int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyListPreChange(list,type) ; } void p3Notify::notifyListChange (int list, int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyListChange (list,type) ; } diff --git a/libretroshare/src/pqi/p3notify.h b/libretroshare/src/pqi/p3notify.h index c9c469dc7..245cef908 100644 --- a/libretroshare/src/pqi/p3notify.h +++ b/libretroshare/src/pqi/p3notify.h @@ -100,7 +100,7 @@ class p3Notify: public RsNotify void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) ; void notifyChatMessage (const ChatMessage& /* msg */) ; void notifyChatStatus (const ChatId& /* chat_id */, const std::string& /* status_string */) ; - void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ ,const std::string& /* nickname */,const std::string& /* any string */) ; + void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ , const RsGxsId & /* nickname */, const std::string& /* any string */) ; void notifyChatLobbyTimeShift (int /* time_shift*/) ; void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) ; void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) ; diff --git a/libretroshare/src/retroshare/rsnotify.h b/libretroshare/src/retroshare/rsnotify.h index 23b311437..9467f2592 100644 --- a/libretroshare/src/retroshare/rsnotify.h +++ b/libretroshare/src/retroshare/rsnotify.h @@ -212,7 +212,7 @@ class NotifyClient virtual void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) {} virtual void notifyChatMessage (const ChatMessage& /* msg */) {} virtual void notifyChatStatus (const ChatId& /* chat_id */, const std::string& /* status_string */) {} - virtual void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ ,const std::string& /* nickname */,const std::string& /* any string */) {} + virtual void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ ,const RsGxsId& /* nickname */,const std::string& /* any string */) {} virtual void notifyChatLobbyTimeShift (int /* time_shift*/) {} virtual void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) {} virtual void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) {} diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.cpp b/retroshare-gui/src/gui/ChatLobbyWidget.cpp index 5eff6908c..d21b08523 100644 --- a/retroshare-gui/src/gui/ChatLobbyWidget.cpp +++ b/retroshare-gui/src/gui/ChatLobbyWidget.cpp @@ -62,7 +62,7 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags) myChatLobbyUserNotify = NULL; QObject::connect( NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged())); - QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,const QString&,const QString&)), this, SLOT(displayChatLobbyEvent(qulonglong,int,const QString&,const QString&))); + QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,const RsGxsId&,const QString&)), this, SLOT(displayChatLobbyEvent(qulonglong,int,const RsGxsId&,const QString&))); QObject::connect( NotifyQt::getInstance(), SIGNAL(chatLobbyInviteReceived()), this, SLOT(readChatLobbyInvites())); QObject::connect( ui.lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCustomPopupMenu(QPoint))); @@ -1054,10 +1054,10 @@ void ChatLobbyWidget::itemDoubleClicked(QTreeWidgetItem *item, int /*column*/) subscribeChatLobbyAtItem(item); } -void ChatLobbyWidget::displayChatLobbyEvent(qulonglong lobby_id, int event_type, const QString& gxs_id, const QString& str) +void ChatLobbyWidget::displayChatLobbyEvent(qulonglong lobby_id, int event_type, const RsGxsId &gxs_id, const QString& str) { if (ChatLobbyDialog *cld = dynamic_cast(ChatDialog::getExistingChat(ChatId(lobby_id)))) { - cld->displayLobbyEvent(event_type, RsGxsId(gxs_id.toStdString()), str); + cld->displayLobbyEvent(event_type, gxs_id, str); } } diff --git a/retroshare-gui/src/gui/ChatLobbyWidget.h b/retroshare-gui/src/gui/ChatLobbyWidget.h index c924fb873..dc19ac2a6 100644 --- a/retroshare-gui/src/gui/ChatLobbyWidget.h +++ b/retroshare-gui/src/gui/ChatLobbyWidget.h @@ -59,7 +59,7 @@ protected slots: void unsubscribeItem(); void itemDoubleClicked(QTreeWidgetItem *item, int column); void updateCurrentLobby() ; - void displayChatLobbyEvent(qulonglong lobby_id, int event_type, const QString& gxs_id, const QString& str); + void displayChatLobbyEvent(qulonglong lobby_id, int event_type, const RsGxsId& gxs_id, const QString& str); void readChatLobbyInvites(); void showLobby(QTreeWidgetItem *lobby_item) ; void showBlankPage(ChatLobbyId id) ; diff --git a/retroshare-gui/src/gui/notifyqt.cpp b/retroshare-gui/src/gui/notifyqt.cpp index 883c05e28..c87b05155 100644 --- a/retroshare-gui/src/gui/notifyqt.cpp +++ b/retroshare-gui/src/gui/notifyqt.cpp @@ -104,6 +104,7 @@ NotifyQt::NotifyQt() : cDialog(NULL) qRegisterMetaType("ChatId"); qRegisterMetaType("ChatMessage"); qRegisterMetaType("RsGxsChanges"); + qRegisterMetaType("RsGxsId"); } void NotifyQt::notifyErrorMsg(int list, int type, std::string msg) @@ -513,7 +514,7 @@ void NotifyQt::handleChatLobbyTimeShift(int /*shift*/) } } -void NotifyQt::notifyChatLobbyEvent(uint64_t lobby_id,uint32_t event_type,const std::string& nickname,const std::string& str) +void NotifyQt::notifyChatLobbyEvent(uint64_t lobby_id,uint32_t event_type,const RsGxsId& nickname,const std::string& str) { { QMutexLocker m(&_mutex) ; @@ -524,7 +525,7 @@ void NotifyQt::notifyChatLobbyEvent(uint64_t lobby_id,uint32_t event_type,const #ifdef NOTIFY_DEBUG std::cerr << "notifyQt: Received chat lobby event message: lobby #" << std::hex << lobby_id << std::dec << ", event=" << event_type << ", str=\"" << str << "\"" << std::endl ; #endif - emit chatLobbyEvent(lobby_id,event_type,QString::fromUtf8(nickname.c_str()),QString::fromUtf8(str.c_str())) ; + emit chatLobbyEvent(lobby_id,event_type,nickname,QString::fromUtf8(str.c_str())) ; } void NotifyQt::notifyChatStatus(const ChatId& chat_id,const std::string& status_string) diff --git a/retroshare-gui/src/gui/notifyqt.h b/retroshare-gui/src/gui/notifyqt.h index c081ef2cc..d6d769b40 100644 --- a/retroshare-gui/src/gui/notifyqt.h +++ b/retroshare-gui/src/gui/notifyqt.h @@ -49,7 +49,7 @@ class NotifyQt: public QObject, public NotifyClient virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list& found_files); 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 notifyChatLobbyEvent(uint64_t /* lobby id */, uint32_t /* event type */, const RsGxsId & /*nickname*/, const std::string& /* any string */) ; virtual void notifyChatLobbyTimeShift(int time_shift) ; virtual void notifyOwnStatusMessageChanged() ; @@ -107,7 +107,7 @@ class NotifyQt: public QObject, public NotifyClient void transfersChanged() const ; void friendsChanged() const ; void lobbyListChanged() const ; - void chatLobbyEvent(qulonglong,int,const QString&,const QString&) ; + void chatLobbyEvent(qulonglong,int,const RsGxsId&,const QString&) ; void neighboursChanged() const ; void messagesChanged() const ; void messagesTagsChanged() const; From 821c14426c1613d43b4bd8097101cb309a9e8b7c Mon Sep 17 00:00:00 2001 From: electron128 Date: Sun, 14 Feb 2016 12:48:52 +0100 Subject: [PATCH 3/3] remove dead code from RsNotify (old forum and channel read status changed notify) --- libretroshare/src/pqi/p3notify.cc | 5 +---- libretroshare/src/pqi/p3notify.h | 5 +---- libretroshare/src/retroshare/rsnotify.h | 5 +---- retroshare-gui/src/gui/notifyqt.cpp | 23 ----------------------- retroshare-gui/src/gui/notifyqt.h | 4 ---- 5 files changed, 3 insertions(+), 39 deletions(-) diff --git a/libretroshare/src/pqi/p3notify.cc b/libretroshare/src/pqi/p3notify.cc index a8102dc0e..26509892c 100644 --- a/libretroshare/src/pqi/p3notify.cc +++ b/libretroshare/src/pqi/p3notify.cc @@ -239,10 +239,7 @@ void p3Notify::notifyGxsChange (const RsGxsChanges& changes) {FOR_A void p3Notify::notifyPeerStatusChangedSummary () { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerStatusChangedSummary() ; } void p3Notify::notifyDiscInfoChanged () { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDiscInfoChanged () ; } -#ifdef REMOVE -void p3Notify::notifyForumMsgReadSatusChanged (const std::string& channelId, const std::string& msgId, uint32_t status) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyForumMsgReadSatusChanged (channelId,msgId,status) ; } -void p3Notify::notifyChannelMsgReadSatusChanged (const std::string& channelId, const std::string& msgId, uint32_t status) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChannelMsgReadSatusChanged (channelId,msgId,status) ; } -#endif + void p3Notify::notifyDownloadComplete (const std::string& fileHash ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDownloadComplete (fileHash) ; } void p3Notify::notifyDownloadCompleteCount (uint32_t count ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDownloadCompleteCount (count) ; } void p3Notify::notifyHistoryChanged (uint32_t msgId , int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHistoryChanged (msgId,type) ; } diff --git a/libretroshare/src/pqi/p3notify.h b/libretroshare/src/pqi/p3notify.h index 245cef908..3c16f5a20 100644 --- a/libretroshare/src/pqi/p3notify.h +++ b/libretroshare/src/pqi/p3notify.h @@ -114,10 +114,7 @@ class p3Notify: public RsNotify void notifyPeerStatusChangedSummary () ; void notifyDiscInfoChanged () ; -#ifdef REMOVE - void notifyForumMsgReadSatusChanged (const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) ; - void notifyChannelMsgReadSatusChanged (const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) ; -#endif + bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result ) ; void notifyDownloadComplete (const std::string& /* fileHash */) ; void notifyDownloadCompleteCount (uint32_t /* count */) ; diff --git a/libretroshare/src/retroshare/rsnotify.h b/libretroshare/src/retroshare/rsnotify.h index 9467f2592..e3045d488 100644 --- a/libretroshare/src/retroshare/rsnotify.h +++ b/libretroshare/src/retroshare/rsnotify.h @@ -227,10 +227,7 @@ class NotifyClient /* one or more peers has changed the states */ virtual void notifyPeerStatusChangedSummary () {} virtual void notifyDiscInfoChanged () {} -#ifdef REMOVE - virtual void notifyForumMsgReadSatusChanged (const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {} - virtual void notifyChannelMsgReadSatusChanged (const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {} -#endif + virtual bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result ) { signature_result = false ;return true; } virtual void notifyDownloadComplete (const std::string& /* fileHash */) {} virtual void notifyDownloadCompleteCount (uint32_t /* count */) {} diff --git a/retroshare-gui/src/gui/notifyqt.cpp b/retroshare-gui/src/gui/notifyqt.cpp index c87b05155..772e05bae 100644 --- a/retroshare-gui/src/gui/notifyqt.cpp +++ b/retroshare-gui/src/gui/notifyqt.cpp @@ -421,29 +421,6 @@ void NotifyQt::notifyGxsChange(const RsGxsChanges& changes) emit gxsChange(changes); } -#ifdef REMOVE -void NotifyQt::notifyForumMsgReadSatusChanged(const std::string& forumId, const std::string& msgId, uint32_t status) -{ - { - QMutexLocker m(&_mutex) ; - if(!_enabled) - return ; - } - - emit forumMsgReadSatusChanged(QString::fromStdString(forumId), QString::fromStdString(msgId), status); -} - -void NotifyQt::notifyChannelMsgReadSatusChanged(const std::string& channelId, const std::string& msgId, uint32_t status) -{ - { - QMutexLocker m(&_mutex) ; - if(!_enabled) - return ; - } - - emit channelMsgReadSatusChanged(QString::fromStdString(channelId), QString::fromStdString(msgId), status); -} -#endif void NotifyQt::notifyOwnStatusMessageChanged() { { diff --git a/retroshare-gui/src/gui/notifyqt.h b/retroshare-gui/src/gui/notifyqt.h index d6d769b40..23feba43f 100644 --- a/retroshare-gui/src/gui/notifyqt.h +++ b/retroshare-gui/src/gui/notifyqt.h @@ -61,10 +61,6 @@ class NotifyQt: public QObject, public NotifyClient virtual void notifyGxsChange(const RsGxsChanges& change); -#ifdef REMOVE - virtual void notifyForumMsgReadSatusChanged(const std::string& forumId, const std::string& msgId, uint32_t status); - virtual void notifyChannelMsgReadSatusChanged(const std::string& channelId, const std::string& msgId, uint32_t status); -#endif virtual void notifyHistoryChanged(uint32_t msgId, int type); virtual void notifyDiscInfoChanged() ;