mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-19 12:54:24 -05:00
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:
parent
a735928749
commit
72dbf59b9d
@ -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"
|
#include "IMHistoryItem.h"
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -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__
|
#ifndef __IM_history_item__
|
||||||
#define __IM_history_item__
|
#define __IM_history_item__
|
||||||
|
|
||||||
|
@ -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 "IMHistoryKeeper.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
@ -121,21 +142,6 @@ IMHistoryKeeper::getMessages(QStringList& messagesList,
|
|||||||
break;
|
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) ;
|
formStringList(ril, messagesList) ;
|
||||||
|
|
||||||
@ -149,13 +155,7 @@ IMHistoryKeeper::formStringList(QList<IMHistoryItem>& itemList,
|
|||||||
QStringList& strList)
|
QStringList& strList)
|
||||||
{
|
{
|
||||||
strList.clear();
|
strList.clear();
|
||||||
/*
|
|
||||||
QList<IMHistoryItem>::const_iterator hii=itemList.constBegin();
|
|
||||||
for(hii; hii!= itemList.constEnd(); hii++)
|
|
||||||
{
|
|
||||||
strList.append( hii->text() );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
QListIterator<IMHistoryItem> hii(itemList);
|
QListIterator<IMHistoryItem> hii(itemList);
|
||||||
hii.toBack();
|
hii.toBack();
|
||||||
while (hii.hasPrevious() )
|
while (hii.hasPrevious() )
|
||||||
|
@ -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_
|
#ifndef _HISTORY_KEEPER_H_
|
||||||
#define _HISTORY_KEEPER_H_
|
#define _HISTORY_KEEPER_H_
|
||||||
|
|
||||||
@ -6,23 +27,56 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
//#include "IMHistoryReader.h"
|
|
||||||
#include "IMHistoryItem.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
|
class IMHistoryKeeper//: public QObject
|
||||||
{
|
{
|
||||||
// Q_OBJECT
|
// Q_OBJECT
|
||||||
public:
|
public:
|
||||||
IMHistoryKeeper();
|
IMHistoryKeeper();
|
||||||
|
|
||||||
IMHistoryKeeper(QString historyFileName);
|
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();
|
virtual ~IMHistoryKeeper();
|
||||||
|
|
||||||
//int setHistoryFileName(QString historyFileName) ;
|
//! last error description
|
||||||
QString errorMessage();
|
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,
|
int getMessages(QStringList& messagesList,
|
||||||
const QString fromID, const QString toID,
|
const QString fromID, const QString toID,
|
||||||
const int messagesCount = 5);
|
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,
|
void addMessage(const QString fromID, const QString toID,
|
||||||
const QString messageText);
|
const QString messageText);
|
||||||
|
|
||||||
|
@ -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 "IMHistoryReader.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
@ -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__
|
#ifndef __IM_History_reader__
|
||||||
#define __IM_History_reader__
|
#define __IM_History_reader__
|
||||||
|
|
||||||
|
@ -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 "IMHistoryWriter.h"
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
@ -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__
|
#ifndef __IM_History_writer__
|
||||||
#define __IM_History_writer__
|
#define __IM_History_writer__
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user