- ported commit from v0.4.x to integrate new RsAvatarItem code

- suppressed compatibility with old avatar transmition code
- added code for storing and sending a custom status string (for e.g. saying "I'm not here now") in p3ChatService
- added code for sending group chat status messages "peer is typing". Not fully functionnal yet.

Warnings: 
- this commit breaks the compatibility for avatar transmission
- the new avatar transmission is not fully working yet




git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1696 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-09-29 20:37:20 +00:00
parent dfee01d4d4
commit 396058c665
15 changed files with 388 additions and 112 deletions

View file

@ -683,13 +683,17 @@ void PeersDialog::configurefriend()
ConfCertDialog::show(getPeerRsCertId(getCurrentPeer()));
}
void PeersDialog::updatePeerStatusString(const QString& peer_id,const QString& status_string)
void PeersDialog::updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat)
{
RshareSettings settings;
// uint chatflags = settings.getChatFlags();
PopupChatDialog *pcd = getPrivateChat(peer_id.toStdString(),rsPeers->getPeerName(peer_id.toStdString()), 0);
pcd->updateStatusString(status_string);
if(is_private_chat)
{
PopupChatDialog *pcd = getPrivateChat(peer_id.toStdString(),rsPeers->getPeerName(peer_id.toStdString()), 0);
pcd->updateStatusString(status_string);
}
else
{
std::cerr << "Updating public chat msg from peer " << rsPeers->getPeerName(peer_id.toStdString()) << ": " << status_string.toStdString() << std::endl ;
}
}
void PeersDialog::insertChat()

View file

@ -68,7 +68,7 @@ public slots:
void on_actionClearChat_triggered();
void displayInfoChatMenu(const QPoint& pos);
void updatePeerStatusString(const QString& peer_id,const QString& status_string) ;
void updatePeerStatusString(const QString& peer_id,const QString& status_string,bool is_private_chat) ;
private slots:

View file

@ -144,7 +144,7 @@ int main(int argc, char *argv[])
QObject::connect(notify,SIGNAL(messagesChanged()) ,w->messagesDialog ,SLOT(insertMessages() )) ;
QObject::connect(notify,SIGNAL(configChanged()) ,w->messagesDialog ,SLOT(displayConfig() )) ;
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&)),w->peersDialog,SLOT(updatePeerStatusString(const QString&,const QString&)));
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->peersDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool)));
QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)),w->networkDialog,SLOT(setLogInfo(QString))) ;
QObject::connect(ConfCertDialog::instance(),SIGNAL(configChanged()),w->networkDialog,SLOT(insertConnect())) ;

View file

@ -39,10 +39,16 @@ void NotifyQt::notifyErrorMsg(int list, int type, std::string msg)
return;
}
void NotifyQt::notifyChatStatus(const std::string& peer_id,const std::string& status_string)
void NotifyQt::notifyCustomState(const std::string& peer_id,const std::string& custom_state_string)
{
std::cerr << "Received chat status string: " << status_string << std::endl ;
emit chatStatusChanged(QString::fromStdString(peer_id),QString::fromStdString(status_string)) ;
std::cerr << "notifyQt: Received custom status string: " << custom_state_string << std::endl ;
emit peerCustomStateStringChanged(QString::fromStdString(peer_id),QString::fromStdString(custom_state_string)) ;
}
void NotifyQt::notifyChatStatus(const std::string& peer_id,const std::string& status_string,bool is_private)
{
std::cerr << "notifyQt: Received chat status string: " << status_string << std::endl ;
emit chatStatusChanged(QString::fromStdString(peer_id),QString::fromStdString(status_string),is_private) ;
}
void NotifyQt::notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files)

View file

@ -24,29 +24,17 @@ class NotifyQt: public QObject, public NotifyBase
public:
NotifyQt()
: cDialog(NULL)
//, pDialog(NULL),
// dDialog(NULL), tDialog(NULL),
// hDialog(NULL), mDialog(NULL),
// sDialog(NULL), mWindow(NULL)
{ return; }
virtual ~NotifyQt() { return; }
void setNetworkDialog(NetworkDialog *c) { cDialog = c; }
// void setPeersDialog(PeersDialog *p) { pDialog = p; }
// void setDirDialog(SharedFilesDialog *d) { dDialog = d; }
// void setTransfersDialog(TransfersDialog *t) { tDialog = t; }
// void setChatDialog(ChatDialog *m) { hDialog = m; }
// void setMessagesDialog(MessagesDialog *m) { mDialog = m; }
// void setChannelsDialog(ChannelsDialog *s) { sDialog = s; }
// void setMessengerWindow(MessengerWindow *mw) { mWindow = mw; }
// void setRsIface(RsIface *i) { iface = i; }
virtual void notifyListPreChange(int list, int type);
virtual void notifyListChange(int list, int type);
virtual void notifyErrorMsg(int list, int sev, std::string msg);
// virtual void notifyChat();
virtual void notifyChatStatus(const std::string& peer_id,const std::string& status_string);
virtual void notifyChatStatus(const std::string& peer_id,const std::string& status_string,bool is_private);
virtual void notifyCustomState(const std::string& peer_id,const std::string& status_string);
virtual void notifyHashingInfo(std::string fileinfo);
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& found_files);
@ -63,7 +51,8 @@ class NotifyQt: public QObject, public NotifyBase
void messagesChanged() const ;
void configChanged() const ;
void logInfoChanged(const QString&) const ;
void chatStatusChanged(const QString&,const QString&) const ;
void chatStatusChanged(const QString&,const QString&,bool) const ;
void peerCustomStateStringChanged(const QString&,const QString&) const ;
void gotTurtleSearchResult(qulonglong search_id,FileDetail file) const ;
public slots:

View file

@ -200,7 +200,8 @@ class NotifyBase
virtual void notifyListChange(int list, int type) { (void) list; (void) type; return; }
virtual void notifyErrorMsg(int list, int sev, std::string msg) { (void) list; (void) sev; (void) msg; return; }
virtual void notifyChat() { return; }
virtual void notifyChatStatus(const std::string& peer_id,const std::string& status_string) {}
virtual void notifyChatStatus(const std::string& peer_id,const std::string& status_string,bool is_private) {}
virtual void notifyCustomState(const std::string& peer_id,const std::string& status_string) {}
virtual void notifyHashingInfo(std::string fileinfo) { (void)fileinfo; return ; }
virtual void notifyTurtleSearchResult(uint32_t search_id,const std::list<TurtleFileInfo>& files) { (void)files; }
};

View file

@ -132,6 +132,10 @@ virtual bool chatAvailable() = 0;
virtual bool ChatSend(ChatInfo &ci) = 0;
virtual bool getNewChat(std::list<ChatInfo> &chats) = 0;
virtual void sendStatusString(const std::string& id,const std::string& status_string) = 0 ;
virtual void sendGroupChatStatusString(const std::string& status_string) = 0 ;
virtual void setCustomStateString(const std::string& status_string) = 0 ;
virtual std::string getCustomStateString() = 0 ;
// get avatar data for peer pid
virtual void getAvatarData(std::string pid,unsigned char *& data,int& size) = 0 ;