mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-18 05:50:39 -04:00
Improvements to chat lobbies:
- added generic methods and items for bouncing generic objects through lobbies - added handling of peer typing status - proper handling of peer join/leave lobby - added sub item ids to lobby messages to allow proper message splitting - made 2 different message splitting methods for normal chat vs. lobbies. In v0.6, we'll have to handle all messages the same way. - added parent id to RsChatLobbyMsgItem, to allow threaded chat. - added possibility to make a lobby public/private (not yet fully working) - added items for requesting/exchanging list of public lobbies at friends' (not yet fully working) - major cleaning of p3chatservice.cc Next move: - gui for listing friend public lobbies, joining them, etc. - load/save of persistent lobbies. - autoremove of inactive lobbies Warning: lobby message items of this version are incompatible with previous versions. It won't crash, but messages will not pass through. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4755 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e430612714
commit
e9d6940b09
20 changed files with 965 additions and 296 deletions
|
@ -68,6 +68,11 @@ ChatLobbyDialog::~ChatLobbyDialog()
|
|||
{
|
||||
// announce leaving of lobby
|
||||
|
||||
// check that the lobby still exists.
|
||||
ChatLobbyId lid ;
|
||||
if(!rsMsgs->isLobbyId(getPeerId(),lid))
|
||||
return ;
|
||||
|
||||
if(QMessageBox::Yes == QMessageBox::question(NULL,tr("Unsubscribe to lobby?"),tr("Do you want to unsubscribe to this chat lobby?"),QMessageBox::Yes | QMessageBox::No))
|
||||
rsMsgs->unsubscribeChatLobby(lobby_id) ;
|
||||
}
|
||||
|
@ -77,11 +82,6 @@ void ChatLobbyDialog::setNickName(const QString& nick)
|
|||
rsMsgs->setNickNameForChatLobby(lobby_id,nick.toUtf8().constData()) ;
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::updateStatus(const QString &peer_id, int status)
|
||||
{
|
||||
// For now. We need something more efficient to tell when the lobby is disconnected.
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::addIncomingChatMsg(const ChatInfo& info)
|
||||
{
|
||||
QDateTime sendTime = QDateTime::fromTime_t(info.sendTime);
|
||||
|
@ -118,3 +118,25 @@ void ChatLobbyDialog::updateFriendsList()
|
|||
friendsListWidget->addItem(QString::fromUtf8((*it2).c_str())) ;
|
||||
}
|
||||
|
||||
void ChatLobbyDialog::displayLobbyEvent(int event_type,const QString& nickname,const QString& str)
|
||||
{
|
||||
switch(event_type)
|
||||
{
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_LEFT: addChatMsg(true, tr("Lobby management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), str + tr(" has left the lobby."), TYPE_NORMAL);
|
||||
break ;
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_JOINED:
|
||||
addChatMsg(true, tr("Lobby management"), QDateTime::currentDateTime(), QDateTime::currentDateTime(), str + tr(" joined the lobby."), TYPE_NORMAL);
|
||||
break ;
|
||||
case RS_CHAT_LOBBY_EVENT_PEER_STATUS:
|
||||
updateStatusString(nickname,str) ;
|
||||
break ;
|
||||
default:
|
||||
std::cerr << "ChatLobbyDialog::displayLobbyEvent() Unhandled lobby event type " << event_type << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
QString ChatLobbyDialog::makeStatusString(const QString& peer_id, const QString& status_string) const
|
||||
{
|
||||
return QString::fromUtf8(peer_id.toStdString().c_str()) + " " + tr(status_string.toAscii());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue