From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/protocols/oscar/liboscar/ssimanager.h | 154 +++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 kopete/protocols/oscar/liboscar/ssimanager.h (limited to 'kopete/protocols/oscar/liboscar/ssimanager.h') diff --git a/kopete/protocols/oscar/liboscar/ssimanager.h b/kopete/protocols/oscar/liboscar/ssimanager.h new file mode 100644 index 00000000..24e87c6a --- /dev/null +++ b/kopete/protocols/oscar/liboscar/ssimanager.h @@ -0,0 +1,154 @@ +/* + Kopete Oscar Protocol + ssimanager.h - SSI management + + Copyright ( c ) 2004 Gustavo Pichorim Boiko + Copyright ( c ) 2004 Matt Rogers + + Kopete ( c ) 2002-2004 by the Kopete developers + + based on ssidata.h and ssidata.cpp ( c ) 2002 Tom Linsky + + ************************************************************************* + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or ( at your option ) any later version. * + * * + ************************************************************************* +*/ + +#ifndef SSIMANAGER_H +#define SSIMANAGER_H + +#include +#include + +#include "oscartypes.h" +#include "oscartypeclasses.h" + +using namespace Oscar; + +class SSIManagerPrivate; + +/** +SSI management + +@author Gustavo Pichorim Boiko +@author Matt Rogers +*/ +class KOPETE_EXPORT SSIManager : public QObject +{ + Q_OBJECT +public: + SSIManager( QObject* parent = 0, const char* name = 0 ); + + ~SSIManager(); + + /** Clear the internal SSI list */ + void clear(); + + /** Get the next buddy id for an SSI item */ + WORD nextContactId(); + + /** Get the next group id for an SSI item */ + WORD nextGroupId(); + + /** Get the number of items in the SSI list. */ + WORD numberOfItems() const; + + /** Get the timestamp the list was last modified */ + DWORD lastModificationTime() const; + + /** Set the timestamp of the last modification time */ + void setLastModificationTime( DWORD lastTime ); + + /** Set the parameters we should use for SSI */ + void setParameters( WORD maxContacts, WORD maxGroups, WORD maxVisible, + WORD maxInvisible, WORD maxIgnore ); + + /** + * Load an existing list from SSI objects. + * The current SSI list will be overwritten and it's contents + * replaced with the data from the new list + */ + void loadFromExisting( const QValueList& newList ); + + bool hasItem( const Oscar::SSI& item ) const; + + Oscar::SSI findGroup( const QString& group ) const; + Oscar::SSI findGroup( int groupId ) const; + + + Oscar::SSI findContact( const QString& contact, const QString& group ) const; + Oscar::SSI findContact( const QString& contact ) const; + Oscar::SSI findContact( int contactId ) const; + + Oscar::SSI findItemForIcon( QByteArray iconHash ) const; + Oscar::SSI findItemForIconByRef( int ) const; + + Oscar::SSI findItem( const QString &contact, int type ) const; + + QValueList groupList() const; + QValueList contactList() const; + QValueList visibleList() const; + QValueList invisibleList() const; + QValueList contactsFromGroup( const QString& group ) const; + QValueList contactsFromGroup( int groupId ) const; + + Oscar::SSI visibilityItem() const; + + void setListComplete( bool complete ); + bool listComplete() const; + +public slots: + bool newGroup( const Oscar::SSI& group ); + bool updateGroup( const Oscar::SSI& group ); + bool removeGroup( const Oscar::SSI& group ); + bool removeGroup( const QString& group ); + + bool newContact( const Oscar::SSI& contact ); + bool updateContact( const Oscar::SSI& contact ); + bool removeContact( const Oscar::SSI& contact ); + bool removeContact( const QString& contact ); + + bool newItem( const Oscar::SSI& item ); + bool updateItem( const Oscar::SSI& item ); + bool removeItem( const Oscar::SSI& item ); + + void addID( const Oscar::SSI& item ); + void removeID( const Oscar::SSI& item ); + +signals: + + //! Emitted when we've added a new contact to the list + void contactAdded( const Oscar::SSI& ); + + //! Emitted when we've updated a contact in the list + void contactUpdated( const Oscar::SSI& ); + + //! Emitted when we've removed a contact from the list + void contactRemoved( const QString& contactName ); + + //! Emitted when we've added a new group to the list + void groupAdded( const Oscar::SSI& ); + + //! Emitted when we've updated a group in the list + void groupUpdated( const Oscar::SSI& ); + + //! Emitted when we've removed a group from the ssi list + void groupRemoved( const QString& groupName ); + + void modifyError( const QString& error ); + +private: + WORD findFreeId( const QValueList& idList, WORD fromId ) const; + + SSIManagerPrivate* d; + Oscar::SSI m_dummyItem; +}; + +#endif + +//kate: tab-width 4; indent-mode csands; -- cgit v1.2.1