added license declaration and some comments

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1086 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
beardog_uk 2009-03-18 20:13:38 +00:00
parent a735928749
commit 72dbf59b9d
8 changed files with 205 additions and 25 deletions

View File

@ -1,3 +1,24 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "IMHistoryItem.h"
//============================================================================

View File

@ -1,3 +1,24 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef __IM_history_item__
#define __IM_history_item__

View File

@ -1,3 +1,24 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "IMHistoryKeeper.h"
#include <QFile>
@ -121,21 +142,6 @@ IMHistoryKeeper::getMessages(QStringList& messagesList,
break;
}
}
/*
QList<IMHistoryItem>::iterator hii ; // history items iterator
for (hii = hitems.begin(); hii != hitems.end(); hii++)
{
//IMHistoryItem* hitem = *hii;
if ( ( (hii->sender()==fromID)&&( hii->receiver()==toID) ) ||
( (hii->receiver()== fromID)&&(hii->sender()==toID) ) )
{
ril << *hii ;
messFound++;
if (messFound>=messagesCount)
break;
}
}
*/
formStringList(ril, messagesList) ;
@ -149,13 +155,7 @@ IMHistoryKeeper::formStringList(QList<IMHistoryItem>& itemList,
QStringList& strList)
{
strList.clear();
/*
QList<IMHistoryItem>::const_iterator hii=itemList.constBegin();
for(hii; hii!= itemList.constEnd(); hii++)
{
strList.append( hii->text() );
}
*/
QListIterator<IMHistoryItem> hii(itemList);
hii.toBack();
while (hii.hasPrevious() )

View File

@ -1,3 +1,24 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _HISTORY_KEEPER_H_
#define _HISTORY_KEEPER_H_
@ -6,23 +27,56 @@
#include <QString>
#include <QStringList>
//#include "IMHistoryReader.h"
#include "IMHistoryItem.h"
//! An engine for instant messaging history management
//! This class holds history for instant messages. It stores all messages
//! in xml file. Something like
//! <?xml version="1.0" encoding="UTF-8"?>
//! <!DOCTYPE history_file>
//! <history_file format_version="1.0">
//! <message dt="10000" sender="ALL" receiver="THIS">manual message</message>
//! ...
//! other messages in <message..> ... </message> tags
//! ...
//! </history_file>
//!
//! The class loads all messages from the file after creation, and saves them
//! at destruction. This means, the more history user has, the more memory
//! will be used. Maybe it's not good, but it isn't so large, I think
class IMHistoryKeeper//: public QObject
{
// Q_OBJECT
public:
IMHistoryKeeper();
IMHistoryKeeper(QString historyFileName);
//! A destructor
//! Warning: history messages will be saved to the file here. This means,
//! a IMHistoryKeeper object must be deleted properly.
virtual ~IMHistoryKeeper();
//int setHistoryFileName(QString historyFileName) ;
//! last error description
QString errorMessage();
//! Select messages from history
//! Fills given list with html-decorated messages (see formStringList(..))
//! Takes no more then messageText messages from history, where messages
//! were sent from fromID to toID, or from toID to fromID. Also, if
//! fromID id ""(empty string), all messages, sent to toID, will be
//! extracted
int getMessages(QStringList& messagesList,
const QString fromID, const QString toID,
const int messagesCount = 5);
//! Adds new message to the history
//! Adds new message to the history, but the message will be saved to
//! file only after destroing the object
void addMessage(const QString fromID, const QString toID,
const QString messageText);

View File

@ -1,3 +1,24 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "IMHistoryReader.h"
#include <QFile>

View File

@ -1,3 +1,24 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef __IM_History_reader__
#define __IM_History_reader__

View File

@ -1,3 +1,24 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "IMHistoryWriter.h"
#include <QFile>

View File

@ -1,3 +1,24 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2009 The RetroShare Team, Oleksiy Bilyanskyy
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef __IM_History_writer__
#define __IM_History_writer__