mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 06:59:27 -05:00
Fixed up GUI side of retroshare messages.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@332 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8527a5e53f
commit
215e3386f2
@ -25,6 +25,7 @@
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsmsgs.h"
|
||||
|
||||
#include "chat/PopupChatDialog.h"
|
||||
#include <sstream>
|
||||
@ -111,15 +112,15 @@ int ChatDialog::loadInitMsg()
|
||||
|
||||
void ChatDialog::insertChat()
|
||||
{
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
std::list<ChatInfo> newchat;
|
||||
if (!rsMsgs->getNewChat(newchat))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* get a link to the table */
|
||||
QTextEdit *msgWidget = ui.msgText;
|
||||
std::list<ChatInfo> newchat = rsiface->getChatNew();
|
||||
std::list<ChatInfo>::iterator it;
|
||||
|
||||
rsiface->unlockData(); /* Unlock Interface */
|
||||
|
||||
static std::string lastChatName("");
|
||||
static int lastChatTime = 0;
|
||||
|
||||
@ -226,7 +227,7 @@ void ChatDialog::sendMsg()
|
||||
//ci.messageFont = font;
|
||||
//ci.messageColor = textColor;
|
||||
|
||||
rsicontrol -> ChatSend(ci);
|
||||
rsMsgs -> ChatSend(ci);
|
||||
lineWidget -> setText(QString(""));
|
||||
|
||||
/* redraw send list */
|
||||
@ -272,8 +273,8 @@ void ChatDialog::insertSendList()
|
||||
//item -> setFlags(Qt::ItemIsUserCheckable);
|
||||
|
||||
item -> setCheckState(0, Qt::Checked);
|
||||
/**** NOT SELECTABLE AT THE MOMENT
|
||||
if (it ->second.inChat)
|
||||
|
||||
if (rsicontrol->IsInChat(*it))
|
||||
{
|
||||
item -> setCheckState(0, Qt::Checked);
|
||||
}
|
||||
@ -281,7 +282,7 @@ void ChatDialog::insertSendList()
|
||||
{
|
||||
item -> setCheckState(0, Qt::Unchecked);
|
||||
}
|
||||
************/
|
||||
|
||||
/* add to the list */
|
||||
items.append(item);
|
||||
}
|
||||
|
@ -20,13 +20,13 @@
|
||||
****************************************************************/
|
||||
|
||||
|
||||
#include "rshare.h"
|
||||
#include "MessagesDialog.h"
|
||||
#include "msgs/ChanMsgDialog.h"
|
||||
#include "gui/toaster/MessageToaster.h"
|
||||
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsmsgs.h"
|
||||
#include <sstream>
|
||||
|
||||
#include <QContextMenuEvent>
|
||||
@ -232,17 +232,13 @@ void MessagesDialog::getcurrentrecommended()
|
||||
void MessagesDialog::getallrecommended()
|
||||
{
|
||||
/* get Message */
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
const MessageInfo *mi =
|
||||
rsiface->getMessage(mCurrCertId, mCurrMsgId);
|
||||
if (!mi)
|
||||
MessageInfo msgInfo;
|
||||
if (!rsMsgs -> getMessage(mCurrMsgId, msgInfo))
|
||||
{
|
||||
rsiface->unlockData(); /* Unlock Interface */
|
||||
return;
|
||||
}
|
||||
|
||||
const std::list<FileInfo> &recList = mi->files;
|
||||
const std::list<FileInfo> &recList = msgInfo.files;
|
||||
std::list<FileInfo>::const_iterator it;
|
||||
|
||||
std::list<std::string> fnames;
|
||||
@ -256,8 +252,6 @@ void MessagesDialog::getallrecommended()
|
||||
sizes.push_back(it->size);
|
||||
}
|
||||
|
||||
rsiface->unlockData(); /* Unlock Interface */
|
||||
|
||||
/* now do requests */
|
||||
std::list<std::string>::const_iterator fit;
|
||||
std::list<std::string>::const_iterator hit;
|
||||
@ -266,7 +260,7 @@ void MessagesDialog::getallrecommended()
|
||||
for(fit = fnames.begin(), hit = hashes.begin(), sit = sizes.begin();
|
||||
fit != fnames.end(); fit++, hit++, sit++)
|
||||
{
|
||||
rsicontrol -> FileRequest(*fit, *hit, *sit, "");
|
||||
//rsicontrol -> FileRequest(*fit, *hit, *sit, "");
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,17 +273,16 @@ void MessagesDialog::changeBox( int newrow )
|
||||
|
||||
void MessagesDialog::insertMessages()
|
||||
{
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
std::list<MsgInfoSummary> msgList;
|
||||
std::list<MsgInfoSummary>::const_iterator it;
|
||||
|
||||
std::list<MessageInfo>::const_iterator it;
|
||||
const std::list<MessageInfo> &msgs = rsiface->getMessages();
|
||||
rsMsgs -> getMessageSummaries(msgList);
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *msgWidget = ui.msgWidget;
|
||||
|
||||
/* get the MsgId of the current one ... */
|
||||
|
||||
|
||||
std::string cid;
|
||||
std::string mid;
|
||||
|
||||
@ -323,7 +316,7 @@ void MessagesDialog::insertMessages()
|
||||
}
|
||||
|
||||
QList<QTreeWidgetItem *> items;
|
||||
for(it = msgs.begin(); it != msgs.end(); it++)
|
||||
for(it = msgList.begin(); it != msgList.end(); it++)
|
||||
{
|
||||
/* check the message flags, to decide which
|
||||
* group it should go in...
|
||||
@ -373,9 +366,7 @@ void MessagesDialog::insertMessages()
|
||||
|
||||
// From ....
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << it -> srcname;
|
||||
item -> setText(1, QString::fromStdString(out.str()));
|
||||
item -> setText(1, QString::fromStdString(rsPeers->getPeerName(it->srcId)));
|
||||
}
|
||||
|
||||
// Subject
|
||||
@ -388,7 +379,7 @@ void MessagesDialog::insertMessages()
|
||||
item -> setText(3, QString::fromStdString(out.str()));
|
||||
}
|
||||
|
||||
item -> setText(4, QString::fromStdString(it->id));
|
||||
item -> setText(4, QString::fromStdString(it->srcId));
|
||||
item -> setText(5, QString::fromStdString(it->msgId));
|
||||
if ((oldSelected) && (mid == it->msgId))
|
||||
{
|
||||
@ -419,8 +410,6 @@ void MessagesDialog::insertMessages()
|
||||
{
|
||||
msgWidget->setCurrentItem(newSelected);
|
||||
}
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
}
|
||||
|
||||
void MessagesDialog::updateMessages( QTreeWidgetItem * item, int column )
|
||||
@ -435,7 +424,7 @@ void MessagesDialog::insertMsgTxtAndFiles()
|
||||
/* Locate the current Message */
|
||||
QTreeWidget *msglist = ui.msgWidget;
|
||||
|
||||
//std::cerr << "MessagesDialog::insertMsgTxtAndFiles()" << std::endl;
|
||||
std::cerr << "MessagesDialog::insertMsgTxtAndFiles()" << std::endl;
|
||||
|
||||
|
||||
/* get its Ids */
|
||||
@ -463,23 +452,21 @@ void MessagesDialog::insertMsgTxtAndFiles()
|
||||
mid = qtwi -> text(5).toStdString();
|
||||
}
|
||||
|
||||
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() mid:" << mid << std::endl;
|
||||
|
||||
/* Save the Data.... for later */
|
||||
|
||||
mCurrCertId = cid;
|
||||
mCurrMsgId = mid;
|
||||
|
||||
/* get Message */
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
const MessageInfo *mi = NULL;
|
||||
mi = rsiface->getMessage(cid, mid);
|
||||
if (!mi)
|
||||
MessageInfo msgInfo;
|
||||
if (!rsMsgs -> getMessage(mid, msgInfo))
|
||||
{
|
||||
rsiface->unlockData(); /* Unlock Interface */
|
||||
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Couldn't find Msg" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
const std::list<FileInfo> &recList = mi->files;
|
||||
const std::list<FileInfo> &recList = msgInfo.files;
|
||||
std::list<FileInfo>::const_iterator it;
|
||||
|
||||
/* get a link to the table */
|
||||
@ -521,60 +508,60 @@ void MessagesDialog::insertMsgTxtAndFiles()
|
||||
/* add the items in! */
|
||||
tree->insertTopLevelItems(0, items);
|
||||
|
||||
/* add the Msg */
|
||||
std::list<PersonInfo>::const_iterator pit;
|
||||
/* iterate through the sources */
|
||||
std::list<std::string>::const_iterator pit;
|
||||
|
||||
QString msgTxt;
|
||||
for(pit = mi->msgto.begin(); pit != mi->msgto.end(); pit++)
|
||||
for(pit = msgInfo.msgto.begin(); pit != msgInfo.msgto.end(); pit++)
|
||||
{
|
||||
msgTxt += QString::fromStdString(pit->name);
|
||||
msgTxt += QString::fromStdString(*pit);
|
||||
msgTxt += " <";
|
||||
msgTxt += QString::fromStdString(pit->id);
|
||||
msgTxt += QString::fromStdString(rsPeers->getPeerName(*pit));
|
||||
msgTxt += ">, ";
|
||||
}
|
||||
|
||||
if (mi->msgcc.size() > 0)
|
||||
if (msgInfo.msgcc.size() > 0)
|
||||
msgTxt += "\nCc: ";
|
||||
for(pit = mi->msgcc.begin(); pit != mi->msgcc.end(); pit++)
|
||||
for(pit = msgInfo.msgcc.begin(); pit != msgInfo.msgcc.end(); pit++)
|
||||
{
|
||||
msgTxt += QString::fromStdString(pit->name);
|
||||
msgTxt += QString::fromStdString(*pit);
|
||||
msgTxt += " <";
|
||||
msgTxt += QString::fromStdString(pit->id);
|
||||
msgTxt += QString::fromStdString(rsPeers->getPeerName(*pit));
|
||||
msgTxt += ">, ";
|
||||
}
|
||||
|
||||
if (mi->msgbcc.size() > 0)
|
||||
if (msgInfo.msgbcc.size() > 0)
|
||||
msgTxt += "\nBcc: ";
|
||||
for(pit = mi->msgbcc.begin(); pit != mi->msgbcc.end(); pit++)
|
||||
for(pit = msgInfo.msgbcc.begin(); pit != msgInfo.msgbcc.end(); pit++)
|
||||
{
|
||||
msgTxt += QString::fromStdString(pit->name);
|
||||
msgTxt += QString::fromStdString(*pit);
|
||||
msgTxt += " <";
|
||||
msgTxt += QString::fromStdString(pit->id);
|
||||
msgTxt += QString::fromStdString(rsPeers->getPeerName(*pit));
|
||||
msgTxt += ">, ";
|
||||
}
|
||||
|
||||
{
|
||||
QDateTime qtime;
|
||||
qtime.setTime_t(mi->ts);
|
||||
qtime.setTime_t(msgInfo.ts);
|
||||
QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss");
|
||||
ui.dateText-> setText(timestamp);
|
||||
}
|
||||
ui.toText->setText(msgTxt);
|
||||
ui.fromText->setText(QString::fromStdString(mi->srcname));
|
||||
ui.fromText->setText(QString::fromStdString(rsPeers->getPeerName(msgInfo.srcId)));
|
||||
|
||||
ui.subjectText->setText(QString::fromStdWString(mi -> title));
|
||||
ui.msgText->setText(QString::fromStdWString(mi->msg));
|
||||
ui.subjectText->setText(QString::fromStdWString(msgInfo.title));
|
||||
ui.msgText->setText(QString::fromStdWString(msgInfo.msg));
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "(" << mi->count << " Files)";
|
||||
out << "(" << msgInfo.count << " Files)";
|
||||
ui.filesText->setText(QString::fromStdString(out.str()));
|
||||
}
|
||||
rsiface->unlockData(); /* Unlock Interface */
|
||||
|
||||
std::cerr << "MessagesDialog::insertMsgTxtAndFiles() Msg Displayed OK!" << std::endl;
|
||||
|
||||
/* finally mark message as read! */
|
||||
rsicontrol -> MessageRead(mid);
|
||||
rsMsgs -> MessageRead(mid);
|
||||
}
|
||||
|
||||
|
||||
@ -608,7 +595,7 @@ void MessagesDialog::removemessage()
|
||||
return;
|
||||
}
|
||||
|
||||
rsicontrol -> MessageDelete(mid);
|
||||
rsMsgs -> MessageDelete(mid);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -625,7 +612,7 @@ void MessagesDialog::markMsgAsRead()
|
||||
return;
|
||||
}
|
||||
|
||||
rsicontrol -> MessageRead(mid);
|
||||
rsMsgs -> MessageRead(mid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
#include "rshare.h"
|
||||
#include "PopupChatDialog.h"
|
||||
|
||||
#include <QTextCodec>
|
||||
@ -31,6 +30,7 @@
|
||||
#include <QTextList>
|
||||
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsmsgs.h"
|
||||
|
||||
|
||||
/* Define the format used for displaying the date and time */
|
||||
@ -300,7 +300,7 @@ void PopupChatDialog::sendChat()
|
||||
ci.rsid = dialogId;
|
||||
ci.name = dialogName;
|
||||
|
||||
rsicontrol -> ChatSend(ci);
|
||||
rsMsgs -> ChatSend(ci);
|
||||
lineWidget -> setText(QString(""));
|
||||
|
||||
/* redraw send list */
|
||||
|
@ -34,6 +34,8 @@ class QAction;
|
||||
class QTextEdit;
|
||||
class QTextCharFormat;
|
||||
|
||||
class ChatInfo;
|
||||
|
||||
class PopupChatDialog : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include "rsiface/rsiface.h"
|
||||
#include "rsiface/rspeers.h"
|
||||
#include "rsiface/rsmsgs.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@ -171,12 +172,9 @@ void ChanMsgDialog::insertSendList()
|
||||
item -> setText(1, QString::fromStdString(detail.id));
|
||||
|
||||
item -> setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||
//item -> setCheckState(0, Qt::Checked);
|
||||
//
|
||||
|
||||
item -> setCheckState(0, Qt::Unchecked);
|
||||
#if 0
|
||||
if (it -> second.inMsg)
|
||||
|
||||
if (rsicontrol->IsInMsg(detail.id))
|
||||
{
|
||||
item -> setCheckState(0, Qt::Checked);
|
||||
}
|
||||
@ -184,7 +182,6 @@ void ChanMsgDialog::insertSendList()
|
||||
{
|
||||
item -> setCheckState(0, Qt::Unchecked);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* add to the list */
|
||||
items.append(item);
|
||||
@ -372,7 +369,6 @@ void ChanMsgDialog::insertMsgText(std::string msg)
|
||||
|
||||
void ChanMsgDialog::sendMessage()
|
||||
{
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
|
||||
/* construct a message */
|
||||
@ -380,8 +376,8 @@ void ChanMsgDialog::sendMessage()
|
||||
|
||||
mi.title = ui.titleEdit->text().toStdWString();
|
||||
mi.msg = ui.msgText->toPlainText().toStdWString();
|
||||
/* filled in later */
|
||||
//mi.msgId = rand();
|
||||
|
||||
rsiface->lockData(); /* Lock Interface */
|
||||
|
||||
const std::list<FileInfo> &recList = rsiface->getRecommendList();
|
||||
std::list<FileInfo>::const_iterator it;
|
||||
@ -393,38 +389,25 @@ void ChanMsgDialog::sendMessage()
|
||||
}
|
||||
}
|
||||
|
||||
std::list<std::string> persons;
|
||||
std::list<std::string>::iterator it3;
|
||||
|
||||
#if 0
|
||||
/* get a list of people to send it to */
|
||||
std::map<RsCertId,NeighbourInfo>::const_iterator it2;
|
||||
const std::map<RsCertId,NeighbourInfo> &friends =
|
||||
rsiface->getFriendMap();
|
||||
|
||||
|
||||
for(it2 = friends.begin(); it2 != friends.end(); it2++)
|
||||
{
|
||||
/* send to all listed + ourselves */
|
||||
if ((it2 -> second.inMsg)
|
||||
|| (it2 -> second.connectString == "Yourself"))
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << it2 -> second.id;
|
||||
persons.push_back(out.str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
rsiface->unlockData(); /* UnLock Interface */
|
||||
|
||||
/* send message */
|
||||
for(it3 = persons.begin(); it3 != persons.end(); it3++)
|
||||
/* get the ids from the send list */
|
||||
std::list<std::string> peers;
|
||||
std::list<std::string> msgto;
|
||||
std::list<std::string>::iterator iit;
|
||||
|
||||
rsPeers->getFriendList(peers);
|
||||
|
||||
for(iit = peers.begin(); iit != peers.end(); iit++)
|
||||
{
|
||||
mi.id = *it3;
|
||||
rsicontrol -> MessageSend(mi);
|
||||
if (rsicontrol->IsInMsg(*iit))
|
||||
{
|
||||
mi.msgto.push_back(*iit);
|
||||
}
|
||||
}
|
||||
|
||||
rsMsgs->MessageSend(mi);
|
||||
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
@ -234,37 +234,6 @@ void NotifyQt::displaySearch()
|
||||
|
||||
void NotifyQt::displayMessages()
|
||||
{
|
||||
iface->lockData(); /* Lock Interface */
|
||||
|
||||
std::ostringstream out;
|
||||
std::cerr << out.str();
|
||||
|
||||
std::list<MessageInfo>::const_iterator it;
|
||||
const std::list<MessageInfo> &msgs = iface->getMessages();
|
||||
|
||||
std::list<FileInfo>::const_iterator fit;
|
||||
int i;
|
||||
|
||||
for(it = msgs.begin(); it != msgs.end(); it++)
|
||||
{
|
||||
out << "Message: ";
|
||||
|
||||
std::string cnv_title(it->title.begin(), it->title.end());
|
||||
out << cnv_title << std::endl;
|
||||
std::string cnv_msg(it->msg.begin(), it->msg.end());
|
||||
out << "\t" << cnv_msg << std::endl;
|
||||
|
||||
const std::list<FileInfo> &files = it -> files;
|
||||
for(fit = files.begin(), i = 1; fit != files.end(); fit++, i++)
|
||||
{
|
||||
out << "\t\tFile(" << i << ") " << fit->fname << std::endl;
|
||||
}
|
||||
out << std::endl;
|
||||
}
|
||||
|
||||
iface->unlockData(); /* UnLock Interface */
|
||||
|
||||
|
||||
if (mDialog)
|
||||
mDialog -> insertMessages();
|
||||
}
|
||||
|
@ -98,24 +98,20 @@ virtual void unlockData() = 0;
|
||||
const PersonInfo *getPerson(std::string id);
|
||||
const DirInfo *getDirectory(std::string id, std::string path);
|
||||
|
||||
const std::list<MessageInfo> &getMessages()
|
||||
{ return mMessageList; }
|
||||
|
||||
const std::map<RsChanId, ChannelInfo> &getChannels()
|
||||
{ return mChannelMap; }
|
||||
|
||||
const std::map<RsChanId, ChannelInfo> &getOurChannels()
|
||||
{ return mChannelOwnMap; }
|
||||
|
||||
const MessageInfo *getMessage(std::string cId, std::string mId);
|
||||
const MessageInfo *getChannelMsg(std::string chId, std::string mId);
|
||||
//const MessageInfo *getChannelMsg(std::string chId, std::string mId);
|
||||
|
||||
std::list<ChatInfo> getChatNew()
|
||||
{
|
||||
std::list<ChatInfo> newList = mChatList;
|
||||
mChatList.clear();
|
||||
return newList;
|
||||
}
|
||||
//std::list<ChatInfo> getChatNew()
|
||||
// {
|
||||
// std::list<ChatInfo> newList = mChatList;
|
||||
// mChatList.clear();
|
||||
// return newList;
|
||||
// }
|
||||
|
||||
const std::list<FileInfo> &getRecommendList()
|
||||
{ return mRecommendList; }
|
||||
@ -162,10 +158,10 @@ void fillLists(); /* create some dummy data to display */
|
||||
std::list<PersonInfo> mRemoteDirList;
|
||||
std::list<PersonInfo> mLocalDirList;
|
||||
std::list<FileTransferInfo> mTransferList;
|
||||
std::list<MessageInfo> mMessageList;
|
||||
//std::list<MessageInfo> mMessageList;
|
||||
std::map<RsChanId, ChannelInfo> mChannelMap;
|
||||
std::map<RsChanId, ChannelInfo> mChannelOwnMap;
|
||||
std::list<ChatInfo> mChatList;
|
||||
//std::list<ChatInfo> mChatList;
|
||||
std::list<FileInfo> mRecommendList;
|
||||
|
||||
bool mChanged[NumOfFlags];
|
||||
@ -218,9 +214,9 @@ virtual int FileSetBandwidthTotals(float outkB, float inkB) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Message Items */
|
||||
virtual int MessageSend(MessageInfo &info) = 0;
|
||||
virtual int MessageDelete(std::string mid) = 0;
|
||||
virtual int MessageRead(std::string mid) = 0;
|
||||
//virtual int MessageSend(MessageInfo &info) = 0;
|
||||
//virtual int MessageDelete(std::string mid) = 0;
|
||||
//virtual int MessageRead(std::string mid) = 0;
|
||||
|
||||
/* Channel Items */
|
||||
virtual int ChannelCreateNew(ChannelInfo &info) = 0;
|
||||
@ -228,7 +224,7 @@ virtual int ChannelSendMsg(ChannelInfo &info) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Chat */
|
||||
virtual int ChatSend(ChatInfo &ci) = 0;
|
||||
//virtual int ChatSend(ChatInfo &ci) = 0;
|
||||
|
||||
/****************************************/
|
||||
|
||||
@ -244,6 +240,9 @@ virtual int ClearInBroadcast() = 0;
|
||||
virtual int ClearInSubscribe() = 0;
|
||||
virtual int ClearInRecommend() = 0;
|
||||
|
||||
virtual bool IsInChat(std::string id) = 0; /* friend : chat msgs */
|
||||
virtual bool IsInMsg(std::string id) = 0; /* friend : msg recpts*/
|
||||
|
||||
/****************************************/
|
||||
/* RsIface Networking */
|
||||
//virtual int NetworkDHTActive(bool active) = 0;
|
||||
|
138
retroshare-gui/src/rsiface/rsmsgs.h
Normal file
138
retroshare-gui/src/rsiface/rsmsgs.h
Normal file
@ -0,0 +1,138 @@
|
||||
#ifndef RS_MSG_GUI_INTERFACE_H
|
||||
#define RS_MSG_GUI_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/rsiface: rsmsgs.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2007-2008 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "rsiface/rstypes.h"
|
||||
|
||||
/********************** For Messages and Channels *****************/
|
||||
|
||||
#define RS_MSG_BOXMASK 0x000f /* Mask for determining Box */
|
||||
|
||||
#define RS_MSG_OUTGOING 0x0001 /* !Inbox */
|
||||
#define RS_MSG_PENDING 0x0002 /* OutBox */
|
||||
#define RS_MSG_DRAFT 0x0004 /* Draft */
|
||||
|
||||
/* ORs of above */
|
||||
#define RS_MSG_INBOX 0x00 /* Inbox */
|
||||
#define RS_MSG_SENTBOX 0x01 /* Sentbox */
|
||||
#define RS_MSG_OUTBOX 0x03 /* Outbox */
|
||||
#define RS_MSG_DRAFTBOX 0x05 /* Draftbox */
|
||||
|
||||
#define RS_MSG_NEW 0x0010
|
||||
|
||||
class MessageInfo
|
||||
{
|
||||
public:
|
||||
MessageInfo() {}
|
||||
std::string msgId;
|
||||
std::string srcId;
|
||||
|
||||
unsigned int msgflags;
|
||||
|
||||
std::list<std::string> msgto;
|
||||
std::list<std::string> msgcc;
|
||||
std::list<std::string> msgbcc;
|
||||
|
||||
std::wstring title;
|
||||
std::wstring msg;
|
||||
|
||||
std::wstring attach_title;
|
||||
std::wstring attach_comment;
|
||||
std::list<FileInfo> files;
|
||||
int size; /* total of files */
|
||||
int count; /* file count */
|
||||
|
||||
int ts;
|
||||
};
|
||||
|
||||
class MsgInfoSummary
|
||||
{
|
||||
public:
|
||||
MsgInfoSummary() {}
|
||||
|
||||
std::string msgId;
|
||||
std::string srcId;
|
||||
|
||||
uint32_t msgflags;
|
||||
|
||||
std::wstring title;
|
||||
int count; /* file count */
|
||||
time_t ts;
|
||||
|
||||
};
|
||||
|
||||
#define RS_CHAT_PUBLIC 0x0001
|
||||
#define RS_CHAT_PRIVATE 0x0002
|
||||
|
||||
class ChatInfo
|
||||
{
|
||||
public:
|
||||
std::string rsid;
|
||||
unsigned int chatflags;
|
||||
std::string name;
|
||||
std::wstring msg;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const MessageInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChatInfo &info);
|
||||
|
||||
class RsMsgs;
|
||||
extern RsMsgs *rsMsgs;
|
||||
|
||||
class RsMsgs
|
||||
{
|
||||
public:
|
||||
|
||||
RsMsgs() { return; }
|
||||
virtual ~RsMsgs() { return; }
|
||||
|
||||
/****************************************/
|
||||
/* Message Items */
|
||||
|
||||
virtual bool getMessageSummaries(std::list<MsgInfoSummary> &msgList) = 0;
|
||||
virtual bool getMessage(std::string mId, MessageInfo &msg) = 0;
|
||||
|
||||
virtual bool MessageSend(MessageInfo &info) = 0;
|
||||
virtual bool MessageDelete(std::string mid) = 0;
|
||||
virtual bool MessageRead(std::string mid) = 0;
|
||||
|
||||
/****************************************/
|
||||
/* Chat */
|
||||
virtual bool ChatSend(ChatInfo &ci) = 0;
|
||||
virtual bool getNewChat(std::list<ChatInfo> &chats) = 0;
|
||||
|
||||
/****************************************/
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -32,25 +32,6 @@
|
||||
#include <string>
|
||||
|
||||
|
||||
#if 0
|
||||
#define RSCERTIDLEN 16
|
||||
|
||||
class RsCertId
|
||||
{
|
||||
public:
|
||||
RsCertId();
|
||||
RsCertId(std::string idstr);
|
||||
|
||||
bool operator<(const RsCertId &ref) const;
|
||||
bool operator==(const RsCertId &ref) const;
|
||||
bool operator!=(const RsCertId &ref) const;
|
||||
char data[RSCERTIDLEN];
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsCertId &id);
|
||||
|
||||
#endif
|
||||
|
||||
typedef std::string RsCertId;
|
||||
typedef std::string RsChanId;
|
||||
typedef std::string RsMsgId;
|
||||
@ -157,48 +138,6 @@ class FileTransferInfo: public FileInfo
|
||||
int downloadStatus; /* 0 = Err, 1 = Ok, 2 = Done */
|
||||
};
|
||||
|
||||
|
||||
/********************** For Messages and Channels *****************/
|
||||
|
||||
#define RS_MSG_BOXMASK 0x000f /* Mask for determining Box */
|
||||
|
||||
#define RS_MSG_OUTGOING 0x0001 /* !Inbox */
|
||||
#define RS_MSG_PENDING 0x0002 /* OutBox */
|
||||
#define RS_MSG_DRAFT 0x0004 /* Draft */
|
||||
|
||||
/* ORs of above */
|
||||
#define RS_MSG_INBOX 0x00 /* Inbox */
|
||||
#define RS_MSG_SENTBOX 0x01 /* Sentbox */
|
||||
#define RS_MSG_OUTBOX 0x03 /* Outbox */
|
||||
#define RS_MSG_DRAFTBOX 0x05 /* Draftbox */
|
||||
|
||||
#define RS_MSG_NEW 0x0010
|
||||
|
||||
class MessageInfo: public BaseInfo
|
||||
{
|
||||
public:
|
||||
MessageInfo() {}
|
||||
RsMsgId msgId;
|
||||
|
||||
unsigned int msgflags;
|
||||
std::string srcname;
|
||||
|
||||
std::list<PersonInfo> msgto;
|
||||
std::list<PersonInfo> msgcc;
|
||||
std::list<PersonInfo> msgbcc;
|
||||
|
||||
std::wstring title;
|
||||
std::wstring msg;
|
||||
|
||||
std::wstring attach_title;
|
||||
std::wstring attach_comment;
|
||||
std::list<FileInfo> files;
|
||||
int size; /* total of files */
|
||||
int count; /* file count */
|
||||
|
||||
int ts;
|
||||
};
|
||||
|
||||
class ChannelInfo: public BaseInfo
|
||||
{
|
||||
public:
|
||||
@ -206,7 +145,7 @@ class ChannelInfo: public BaseInfo
|
||||
RsChanId chanId;
|
||||
bool publisher;
|
||||
std::string chanName;
|
||||
std::list<MessageInfo> msglist;
|
||||
//std::list<MessageInfo> msglist;
|
||||
|
||||
/* details */
|
||||
int mode;
|
||||
@ -219,18 +158,6 @@ class ChannelInfo: public BaseInfo
|
||||
int count; /* msg count */
|
||||
};
|
||||
|
||||
#define RS_CHAT_PUBLIC 0x0001
|
||||
#define RS_CHAT_PRIVATE 0x0002
|
||||
|
||||
class ChatInfo: public BaseInfo
|
||||
{
|
||||
public:
|
||||
std::string rsid;
|
||||
unsigned int chatflags;
|
||||
std::string name;
|
||||
std::wstring msg;
|
||||
};
|
||||
|
||||
/* matched to the uPnP states */
|
||||
#define UPNP_STATE_UNINITIALISED 0
|
||||
#define UPNP_STATE_UNAVAILABILE 1
|
||||
@ -303,9 +230,7 @@ class SearchRequest
|
||||
};
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const MessageInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChannelInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const ChatInfo &info);
|
||||
std::ostream &operator<<(std::ostream &out, const PersonInfo &info);
|
||||
std::ostream &print(std::ostream &out, const DirInfo &info, int indentLvl);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user