1 /* 2 Kopete Oscar Protocol 3 oscarutils.h - Oscar Utility Functions 4 5 Copyright (c) 2004 Matt Rogers <mattr@kde.org> 6 7 Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org> 8 9 ************************************************************************* 10 * * 11 * This library is free software; you can redistribute it and/or * 12 * modify it under the terms of the GNU Lesser General Public * 13 * License as published by the Free Software Foundation; either * 14 * version 2 of the License, or (at your option) any later version. * 15 * * 16 ************************************************************************* 17 */ 18 19 #ifndef _OSCARUTILS_H_ 20 #define _OSCARUTILS_H_ 21 22 #include <qglobal.h> 23 #include <QList> 24 #include <QString> 25 #include "oscartypes.h" 26 #include "buffer.h" 27 #include "contact.h" 28 29 namespace Oscar 30 { 31 32 ///Normalize the contact name to all lowercase and no spaces 33 LIBOSCAR_EXPORT QString normalize( const QString& ); 34 35 ///compare TLVs for equality 36 LIBOSCAR_EXPORT bool operator==( TLV, TLV ); 37 38 /** 39 * Find the TLV corresponding to the type in the list 40 */ 41 LIBOSCAR_EXPORT TLV findTLV( const QList<TLV>&, int type ); 42 43 /** 44 * Update TLVs of SSI item from TLV list if necessary 45 * \return true if something was updated 46 */ 47 LIBOSCAR_EXPORT bool updateTLVs( OContact& item, const QList<TLV>& list ); 48 49 /** 50 * Get the name of the capability from its number 51 */ 52 const QString capName( int capNumber ); 53 54 /** 55 * Convert an IP address in dotted decimal notation to a 56 * numerical constant 57 */ 58 Oscar::DWORD getNumericalIP( const QString& address ); 59 60 /** 61 * Convert a numerical constant that is an IP address to 62 * dotted decimal format 63 */ 64 QString getDottedDecimal( Oscar::DWORD address ); 65 66 /** 67 * Searches all QTextCodec objects and returns the one which best matches name. 68 * Returns 0 if no codec matching the name name could be found. 69 */ 70 QTextCodec * codecForName( const QByteArray& name ); 71 72 } 73 74 #endif 75 76