diff options
Diffstat (limited to 'kopete/protocols/yahoo/libkyahoo')
98 files changed, 17730 insertions, 0 deletions
diff --git a/kopete/protocols/yahoo/libkyahoo/Makefile.am b/kopete/protocols/yahoo/libkyahoo/Makefile.am new file mode 100644 index 00000000..b5e8e034 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/Makefile.am @@ -0,0 +1,23 @@ +SUBDIRS = . tests +METASOURCES = AUTO +noinst_LTLIBRARIES = libkyahoo.la + +AM_CPPFLAGS = $(all_includes) + + +libkyahoo_la_SOURCES = client.cpp task.cpp connector.cpp inputprotocolbase.cpp \ + ymsgprotocol.cpp ymsgtransfer.cpp transfer.cpp yahoobytestream.cpp bytestream.cpp \ + yahooclientstream.cpp yahooconnector.cpp safedelete.cpp stream.cpp sha1.c md5.c crypt.c \ + coreprotocol.cpp logintask.cpp libyahoo.c yahoo_fn.c listtask.cpp statusnotifiertask.cpp \ + mailnotifiertask.cpp messagereceivertask.cpp sendnotifytask.cpp sendmessagetask.cpp \ + logofftask.cpp changestatustask.cpp modifybuddytask.cpp picturenotifiertask.cpp \ + requestpicturetask.cpp yahoobuddyiconloader.cpp stealthtask.cpp sendpicturetask.cpp \ + webcamtask.cpp conferencetask.cpp sendauthresptask.cpp pingtask.cpp yabtask.cpp \ + yabentry.cpp modifyyabtask.cpp chatsessiontask.cpp sendfiletask.cpp filetransfernotifiertask.cpp \ + receivefiletask.cpp +libkyahoo_la_LDFLAGS = -no-undefined $(all_libraries) +libkyahoo_la_LIBADD = $(LIB_QT) + +noinst_HEADERS = logintask.h yabentry.h yabtask.h modifyyabtask.h \ + chatsessiontask.h +KDE_OPTIONS = nofinal diff --git a/kopete/protocols/yahoo/libkyahoo/bytestream.cpp b/kopete/protocols/yahoo/libkyahoo/bytestream.cpp new file mode 100644 index 00000000..2da5ceef --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/bytestream.cpp @@ -0,0 +1,289 @@ +/* + * bytestream.cpp - base class for bytestreams + * Copyright (C) 2003 Justin Karneges + * + * 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.1 of the License, or (at your option) any later version. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 + * + */ + +#include <kdebug.h> +#include"bytestream.h" + +// CS_NAMESPACE_BEGIN + +//! \class ByteStream bytestream.h +//! \brief Base class for "bytestreams" +//! +//! This class provides a basic framework for a "bytestream", here defined +//! as a bi-directional, asynchronous pipe of data. It can be used to create +//! several different kinds of bytestream-applications, such as a console or +//! TCP connection, or something more abstract like a security layer or tunnel, +//! all with the same interface. The provided functions make creating such +//! classes simpler. ByteStream is a pure-virtual class, so you do not use it +//! on its own, but instead through a subclass such as \a BSocket. +//! +//! The signals connectionClosed(), delayedCloseFinished(), readyRead(), +//! bytesWritten(), and error() serve the exact same function as those from +//! <A HREF="http://doc.trolltech.com/3.1/qsocket.html">QSocket</A>. +//! +//! The simplest way to create a ByteStream is to reimplement isOpen(), close(), +//! and tryWrite(). Call appendRead() whenever you want to make data available for +//! reading. ByteStream will take care of the buffers with regards to the caller, +//! and will call tryWrite() when the write buffer gains data. It will be your +//! job to call tryWrite() whenever it is acceptable to write more data to +//! the underlying system. +//! +//! If you need more advanced control, reimplement read(), write(), bytesAvailable(), +//! and/or bytesToWrite() as necessary. +//! +//! Use appendRead(), appendWrite(), takeRead(), and takeWrite() to modify the +//! buffers. If you have more advanced requirements, the buffers can be accessed +//! directly with readBuf() and writeBuf(). +//! +//! Also available are the static convenience functions ByteStream::appendArray() +//! and ByteStream::takeArray(), which make dealing with byte queues very easy. + +class ByteStream::Private +{ +public: + Private() {} + + QByteArray readBuf, writeBuf; +}; + +//! +//! Constructs a ByteStream object with parent \a parent. +ByteStream::ByteStream(QObject *parent) +:QObject(parent) +{ +// kdDebug(14181) << k_funcinfo << endl; + d = new Private; +} + +//! +//! Destroys the object and frees allocated resources. +ByteStream::~ByteStream() +{ + delete d; +} + +//! +//! Returns TRUE if the stream is open, meaning that you can write to it. +bool ByteStream::isOpen() const +{ + return false; +} + +//! +//! Closes the stream. If there is data in the write buffer then it will be +//! written before actually closing the stream. Once all data has been written, +//! the delayedCloseFinished() signal will be emitted. +//! \sa delayedCloseFinished() +void ByteStream::close() +{ +} + +//! +//! Writes array \a a to the stream. +void ByteStream::write(const QByteArray &a) +{ +// kdDebug(14181) << k_funcinfo << "[data size: " << a.size() << "]" << endl; + +// kdDebug(14181) << k_funcinfo << "[Data: " << a << "]" << endl; + + if(!isOpen()) + return; + + bool doWrite = bytesToWrite() == 0 ? true: false; + appendWrite(a); + if(doWrite) + tryWrite(); +} + +//! +//! Reads bytes \a bytes of data from the stream and returns them as an array. If \a bytes is 0, then +//! \a read will return all available data. +QByteArray ByteStream::read(int bytes) +{ +// kdDebug(14181) << k_funcinfo << " " << bytes <<" [bytes]"<< endl; + return takeRead(bytes); +} + +//! +//! Returns the number of bytes available for reading. +int ByteStream::bytesAvailable() const +{ + return d->readBuf.size(); +} + +//! +//! Returns the number of bytes that are waiting to be written. +int ByteStream::bytesToWrite() const +{ +// kdDebug(14181) << k_funcinfo << "[bytes left: " << d->writeBuf.size() << " ]" << endl; + return d->writeBuf.size(); +} + +//! +//! Writes string \a cs to the stream. +void ByteStream::write(const QCString &cs) +{ +// kdDebug(14181) << k_funcinfo << "[data size: " << cs.length() << "]" << endl; + + QByteArray block(cs.length()); + memcpy(block.data(), cs.data(), block.size()); + write(block); +} + +//! +//! Clears the read buffer. +void ByteStream::clearReadBuffer() +{ + d->readBuf.resize(0); +} + +//! +//! Clears the write buffer. +void ByteStream::clearWriteBuffer() +{ + d->writeBuf.resize(0); +} + +//! +//! Appends \a block to the end of the read buffer. +void ByteStream::appendRead(const QByteArray &block) +{ +// kdDebug(14181) << k_funcinfo << endl; + appendArray(&d->readBuf, block); +} + +//! +//! Appends \a block to the end of the write buffer. +void ByteStream::appendWrite(const QByteArray &block) +{ +// kdDebug(14181) << k_funcinfo << "[data size: " << block.size() << "]" << endl; + + appendArray(&d->writeBuf, block); +} + +//! +//! Returns \a size bytes from the start of the read buffer. +//! If \a size is 0, then all available data will be returned. +//! If \a del is TRUE, then the bytes are also removed. +QByteArray ByteStream::takeRead(int size, bool del) +{ +// kdDebug(14181) << k_funcinfo << "[data size: " << size << "][ delete :" << del << " ]" << endl; + return takeArray(&d->readBuf, size, del); +} + +//! +//! Returns \a size bytes from the start of the write buffer. +//! If \a size is 0, then all available data will be returned. +//! If \a del is TRUE, then the bytes are also removed. +QByteArray ByteStream::takeWrite(int size, bool del) +{ +// kdDebug(14181) << k_funcinfo << "[data size: " << size << "][ delete :" << del << " ]" << endl; + return takeArray(&d->writeBuf, size, del); +} + +//! +//! Returns a reference to the read buffer. +QByteArray & ByteStream::readBuf() +{ + return d->readBuf; +} + +//! +//! Returns a reference to the write buffer. +QByteArray & ByteStream::writeBuf() +{ +// kdDebug(14181) << k_funcinfo << endl; + return d->writeBuf; +} + +//! +//! Attempts to try and write some bytes from the write buffer, and returns the number +//! successfully written or -1 on error. The default implementation returns -1. +int ByteStream::tryWrite() +{ +// kdDebug(14181) << k_funcinfo << "(THIS RETURNS -1)" << endl; + return -1; +} + +//! +//! Append array \a b to the end of the array pointed to by \a a. +void ByteStream::appendArray(QByteArray *a, const QByteArray &b) +{ +// kdDebug(14181) << k_funcinfo << endl; + int oldsize = a->size(); + a->resize(oldsize + b.size()); + memcpy(a->data() + oldsize, b.data(), b.size()); +} + +//! +//! Returns \a size bytes from the start of the array pointed to by \a from. +//! If \a size is 0, then all available data will be returned. +//! If \a del is TRUE, then the bytes are also removed. +QByteArray ByteStream::takeArray(QByteArray *from, int size, bool del) +{ +// kdDebug(14181) << k_funcinfo << "[int size] : " << size << " [bool del] " << del << endl; + + QByteArray a; + if(size == 0) { + a = from->copy(); + if(del) + from->resize(0); + } + else { + if(size > (int)from->size()) + size = from->size(); + a.resize(size); + char *r = from->data(); + memcpy(a.data(), r, size); + if(del) { + int newsize = from->size()-size; + memmove(r, r+size, newsize); + from->resize(newsize); + } + } + return a; +} + void connectionClosed(); + void delayedCloseFinished(); + void readyRead(); + void bytesWritten(int); + void error(int); + +//! \fn void ByteStream::connectionClosed() +//! This signal is emitted when the remote end of the stream closes. + +//! \fn void ByteStream::delayedCloseFinished() +//! This signal is emitted when all pending data has been written to the stream +//! after an attempt to close. + +//! \fn void ByteStream::readyRead() +//! This signal is emitted when data is available to be read. + +//! \fn void ByteStream::bytesWritten(int x); +//! This signal is emitted when data has been successfully written to the stream. +//! \a x is the number of bytes written. + +//! \fn void ByteStream::error(int code) +//! This signal is emitted when an error occurs in the stream. The reason for +//! error is indicated by \a code. + +// CS_NAMESPACE_END + +#include "bytestream.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/bytestream.h b/kopete/protocols/yahoo/libkyahoo/bytestream.h new file mode 100644 index 00000000..7f964fbd --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/bytestream.h @@ -0,0 +1,78 @@ +/* + * bytestream.h - base class for bytestreams + * Copyright (C) 2003 Justin Karneges + * + * 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.1 of the License, or (at your option) any later version. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser 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 + * + */ + +#ifndef CS_BYTESTREAM_H +#define CS_BYTESTREAM_H + +#include <qobject.h> +#include <qcstring.h> + +// CS_NAMESPACE_BEGIN + +// CS_EXPORT_BEGIN +class ByteStream : public QObject +{ + Q_OBJECT +public: + enum Error { ErrRead, ErrWrite, ErrCustom = 10 }; + ByteStream(QObject *parent=0); + virtual ~ByteStream()=0; + + virtual bool isOpen() const; + virtual void close(); + virtual void write(const QByteArray &); + virtual QByteArray read(int bytes=0); + virtual int bytesAvailable() const; + virtual int bytesToWrite() const; + + void write(const QCString &); + + static void appendArray(QByteArray *a, const QByteArray &b); + static QByteArray takeArray(QByteArray *from, int size=0, bool del=true); + +signals: + void connectionClosed(); + void delayedCloseFinished(); + void readyRead(); + void bytesWritten(int); + void error(int); + +protected: + void clearReadBuffer(); + void clearWriteBuffer(); + void appendRead(const QByteArray &); + void appendWrite(const QByteArray &); + QByteArray takeRead(int size=0, bool del=true); + QByteArray takeWrite(int size=0, bool del=true); + QByteArray & readBuf(); + QByteArray & writeBuf(); + virtual int tryWrite(); + +private: +//! \if _hide_doc_ + class Private; + Private *d; +//! \endif +}; +// CS_EXPORT_END + +// CS_NAMESPACE_END + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/changestatustask.cpp b/kopete/protocols/yahoo/libkyahoo/changestatustask.cpp new file mode 100644 index 00000000..a4da7b57 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/changestatustask.cpp @@ -0,0 +1,85 @@ +/* + Kopete Yahoo Protocol + Change our Status + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "changestatustask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> + +ChangeStatusTask::ChangeStatusTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +ChangeStatusTask::~ChangeStatusTask() +{ +} + +void ChangeStatusTask::onGo() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if( m_status == Yahoo::StatusInvisible ) // status --> Invisible + { + sendVisibility( Invisible ); + } + else + { + YMSGTransfer *t = new YMSGTransfer( Yahoo::ServiceStatus ); + t->setId( client()->sessionID() ); + + if( !m_message.isEmpty() ) + { + m_status = Yahoo::StatusCustom; + t->setParam( 19, m_message.utf8() ); + } + t->setParam( 10, m_status ); + t->setParam( 47, m_type ); + t->setParam( 97, 1 ); // it's utf8 + + send( t ); + + if( client()->status() == Yahoo::StatusInvisible ) // Invisible --> Status + sendVisibility( Visible ); + } + setSuccess( true ); +} + +void ChangeStatusTask::sendVisibility( Visibility visible ) +{ + YMSGTransfer *t = new YMSGTransfer( Yahoo::ServiceVisibility ); + t->setId( client()->sessionID() ); + t->setParam( 13, visible ); + send( t ); +} + +void ChangeStatusTask::setMessage( const QString &msg ) +{ + m_message = msg; +} + +void ChangeStatusTask::setStatus( Yahoo::Status status ) +{ + m_status = status; +} + +void ChangeStatusTask::setType( Yahoo::StatusType type ) +{ + m_type = type; +} diff --git a/kopete/protocols/yahoo/libkyahoo/changestatustask.h b/kopete/protocols/yahoo/libkyahoo/changestatustask.h new file mode 100644 index 00000000..5455c665 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/changestatustask.h @@ -0,0 +1,50 @@ +/* + Kopete Yahoo Protocol + Change our Status + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 CHANGESTATUSTASK_H +#define CHANGESTATUSTASK_H + +#include "task.h" +#include "yahootypes.h" + +class QString; + + +/** +@author André Duffeck +*/ +class ChangeStatusTask : public Task +{ +public: + enum Type { Available, Away }; + ChangeStatusTask(Task *parent); + ~ChangeStatusTask(); + + virtual void onGo(); + + void setMessage( const QString &msg ); + void setStatus( Yahoo::Status status ); + void setType( Yahoo::StatusType type ); +private: + enum Visibility { Visible = 1, Invisible = 2 }; + QString m_message; + Yahoo::Status m_status; + Yahoo::StatusType m_type; + + void sendVisibility( Visibility visible ); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/chatsessiontask.cpp b/kopete/protocols/yahoo/libkyahoo/chatsessiontask.cpp new file mode 100644 index 00000000..553297e9 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/chatsessiontask.cpp @@ -0,0 +1,66 @@ +/* + Kopete Yahoo Protocol + chatsessiontask.cpp - Register / Unregister a chatsession + + Copyright (c) 2006 André Duffeck <[email protected]> + + Kopete (c) 2002-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "chatsessiontask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> + +ChatSessionTask::ChatSessionTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +ChatSessionTask::~ChatSessionTask() +{ +} + +void ChatSessionTask::onGo() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer( Yahoo::ServiceChatSession ); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + t->setParam( 5, m_target.local8Bit() ); + if( m_type == RegisterSession ) + { + t->setParam( 13, 1 ); + } + else + { + t->setParam( 13, 2 ); + t->setParam( 34, 1 ); + } + send( t ); + + setSuccess( true ); +} + +void ChatSessionTask::setTarget( const QString &to ) +{ + m_target = to; +} + +void ChatSessionTask::setType( Type type ) +{ + m_type = type; +} diff --git a/kopete/protocols/yahoo/libkyahoo/chatsessiontask.h b/kopete/protocols/yahoo/libkyahoo/chatsessiontask.h new file mode 100644 index 00000000..b5b5c76c --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/chatsessiontask.h @@ -0,0 +1,45 @@ +/* + Kopete Yahoo Protocol + chatsessiontask.h - Register / Unregister a chatsession + + Copyright (c) 2006 André Duffeck <[email protected]> + + Kopete (c) 2002-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 CHATSESSIONTASK_H +#define CHATSESSIONTASK_H + +#include "task.h" + +class QString; + +/** +@author André Duffeck +*/ +class ChatSessionTask : public Task +{ +public: + enum Type { RegisterSession, UnregisterSession }; + ChatSessionTask(Task *parent); + ~ChatSessionTask(); + + virtual void onGo(); + + void setTarget( const QString &to ); + void setType( Type type ); +private: + QString m_target; + Type m_type; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/client.cpp b/kopete/protocols/yahoo/libkyahoo/client.cpp new file mode 100644 index 00000000..186f1e12 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/client.cpp @@ -0,0 +1,869 @@ +/* + Kopete Yahoo Protocol + + Copyright (c) 2005-2006 André Duffeck <[email protected]> + Copyright (c) 2004 Duncan Mac-Vicar P. <[email protected]> + Copyright (c) 2004 Matt Rogers <[email protected]> + Copyright (c) 2004 SuSE Linux AG <http://www.suse.com> + Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include <qtimer.h> + +#include <kdebug.h> +#include <kurl.h> +#include <ksocketbase.h> + +#include "yahooclientstream.h" +#include "yahooconnector.h" +#include "task.h" +#include "logintask.h" +#include "listtask.h" +#include "statusnotifiertask.h" +#include "mailnotifiertask.h" +#include "messagereceivertask.h" +#include "sendnotifytask.h" +#include "sendmessagetask.h" +#include "logofftask.h" +#include "changestatustask.h" +#include "modifybuddytask.h" +#include "picturenotifiertask.h" +#include "requestpicturetask.h" +#include "stealthtask.h" +#include "sendpicturetask.h" +#include "webcamtask.h" +#include "conferencetask.h" +#include "sendauthresptask.h" +#include "pingtask.h" +#include "yabtask.h" +#include "modifyyabtask.h" +#include "chatsessiontask.h" +#include "sendfiletask.h" +#include "filetransfernotifiertask.h" +#include "receivefiletask.h" +#include "client.h" +#include "yahootypes.h" +#include "yahoobuddyiconloader.h" + +using namespace KNetwork; + +class Client::ClientPrivate +{ +public: + ClientPrivate() {} + + ClientStream *stream; + int id_seed; + Task *root; + QString host, user, pass; + uint port; + bool active; + YahooBuddyIconLoader *iconLoader; + int error; + QString errorString; + QString errorInformation; + + // tasks + bool tasksInitialized; + LoginTask * loginTask; + ListTask *listTask; + StatusNotifierTask *statusTask; + MailNotifierTask *mailTask; + MessageReceiverTask *messageReceiverTask; + PictureNotifierTask *pictureNotifierTask; + WebcamTask *webcamTask; + ConferenceTask *conferenceTask; + YABTask *yabTask; + FileTransferNotifierTask *fileTransferTask; + + // Connection data + uint sessionID; + QString yCookie; + QString tCookie; + QString cCookie; + Yahoo::Status status; + Yahoo::Status statusOnConnect; + QString statusMessageOnConnect; + int pictureFlag; +}; + +Client::Client(QObject *par) :QObject(par, "yahooclient" ) +{ + d = new ClientPrivate; +/* d->tzoffset = 0;*/ + d->active = false; + + d->root = new Task(this, true); + d->statusOnConnect = Yahoo::StatusAvailable; + setStatus( Yahoo::StatusDisconnected ); + d->tasksInitialized = false; + d->stream = 0L; + d->iconLoader = 0L; + d->loginTask = new LoginTask( d->root ); + d->listTask = new ListTask( d->root ); + d->pictureFlag = 0; + m_connector = 0L; + + m_pingTimer = new QTimer( this ); + QObject::connect( m_pingTimer, SIGNAL( timeout() ), this, SLOT( sendPing() ) ); + + QObject::connect( d->loginTask, SIGNAL( haveSessionID( uint ) ), SLOT( lt_gotSessionID( uint ) ) ); + QObject::connect( d->loginTask, SIGNAL( loginResponse( int, const QString& ) ), + SLOT( slotLoginResponse( int, const QString& ) ) ); + QObject::connect( d->loginTask, SIGNAL( haveCookies() ), SLOT( slotGotCookies() ) ); + QObject::connect( d->listTask, SIGNAL( gotBuddy(const QString &, const QString &, const QString &) ), + SIGNAL( gotBuddy(const QString &, const QString &, const QString &) ) ); + QObject::connect( d->listTask, SIGNAL( stealthStatusChanged( const QString&, Yahoo::StealthStatus ) ), + SIGNAL( stealthStatusChanged( const QString&, Yahoo::StealthStatus ) ) ); +} + +Client::~Client() +{ + close(); + delete d->iconLoader; + delete d->root; + delete d; +} + +void Client::connect( const QString &host, const uint port, const QString &userId, const QString &pass ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + d->host = host; + d->port = port; + d->user = userId; + d->pass = pass; + setStatus( Yahoo::StatusConnecting ); + + m_connector = new KNetworkConnector; + m_connector->setOptHostPort( host, port ); + d->stream = new ClientStream( m_connector, this ); + QObject::connect( d->stream, SIGNAL( connected() ), this, SLOT( cs_connected() ) ); + QObject::connect( d->stream, SIGNAL( error(int) ), this, SLOT( streamError(int) ) ); + QObject::connect( d->stream, SIGNAL( readyRead() ), this, SLOT( streamReadyRead() ) ); + + d->stream->connectToServer( host, false ); +} + +void Client::cancelConnect() +{ + d->loginTask->reset(); +} + +void Client::cs_connected() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + emit connected(); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " starting login task ... "<< endl; + + d->loginTask->setStateOnConnect( (d->statusOnConnect == Yahoo::StatusInvisible) ? Yahoo::StatusInvisible : Yahoo::StatusAvailable ); + d->loginTask->go(); + d->active = true; +} + +void Client::close() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + m_pingTimer->stop(); + if( d->active ) + { + LogoffTask *lt = new LogoffTask( d->root ); + lt->go( true ); + } + if( d->tasksInitialized) + deleteTasks(); + d->loginTask->reset(); + if( d->stream ) { + QObject::disconnect( d->stream, SIGNAL( readyRead() ), this, SLOT( streamReadyRead() ) ); + d->stream->deleteLater(); + } + d->stream = 0L; + if( m_connector ) + m_connector->deleteLater(); + m_connector = 0L; +} + +int Client::error() +{ + return d->error; +} + +QString Client::errorString() +{ + return d->errorString; +} + +QString Client::errorInformation() +{ + return d->errorInformation; +} + +// SLOTS // +void Client::streamError( int error ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "CLIENT ERROR (Error " << error << ")" << endl; + QString msg; + + d->active = false; + + // Examine error + if( error == ClientStream::ErrConnection ) // Ask Connector in this case + { + d->error = m_connector->errorCode(); + d->errorString = KSocketBase::errorString( (KSocketBase::SocketError)d->error ); + } + else + { + d->error = error; + d->errorString = d->stream->errorText(); + } + close(); + if( status() == Yahoo::StatusConnecting ) + emit loginFailed(); + else + emit disconnected(); +} + +void Client::streamReadyRead() +{ + // take the incoming transfer and distribute it to the task tree + Transfer * transfer = d->stream->read(); + distribute( transfer ); +} + +void Client::lt_loginFinished() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + slotLoginResponse( d->loginTask->statusCode(), d->loginTask->statusString() ); +} + +void Client::slotLoginResponse( int response, const QString &msg ) +{ + if( response == Yahoo::LoginOk ) + { + if( !(d->statusOnConnect == Yahoo::StatusAvailable || + d->statusOnConnect == Yahoo::StatusInvisible) || + !d->statusMessageOnConnect.isEmpty() ) + changeStatus( d->statusOnConnect, d->statusMessageOnConnect, Yahoo::StatusTypeAway ); + d->statusMessageOnConnect = QString::null; + setStatus( d->statusOnConnect ); + m_pingTimer->start( 60 * 1000 ); + initTasks(); + } else { + d->active = false; + close(); + } + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Emitting loggedIn" << endl; + emit loggedIn( response, msg ); +} + +void Client::lt_gotSessionID( uint id ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Got SessionID: " << id << endl; + d->sessionID = id; +} + +void Client::slotGotCookies() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Y: " << d->loginTask->yCookie() + << " T: " << d->loginTask->tCookie() + << " C: " << d->loginTask->cCookie() << endl; + d->yCookie = d->loginTask->yCookie(); + d->tCookie = d->loginTask->tCookie(); + d->cCookie = d->loginTask->cCookie(); +} + +// INTERNALS // + +// ***** Messaging handling ***** +void Client::sendTyping( const QString &who, bool typing ) +{ + SendNotifyTask *snt = new SendNotifyTask( d->root ); + snt->setTarget( who ); + snt->setState( typing ? SendNotifyTask::Active : SendNotifyTask::NotActive ); + snt->setType( SendNotifyTask::NotifyTyping ); + snt->go( true ); +} + +void Client::sendWebcamInvite( const QString &who ) +{ + if( !d->webcamTask->transmitting() ) + d->webcamTask->registerWebcam(); + + d->webcamTask->addPendingInvitation( who ); +} + +void Client::sendMessage( const QString &to, const QString &msg ) +{ + SendMessageTask *smt = new SendMessageTask( d->root ); + smt->setTarget( to ); + smt->setText( msg ); + smt->setPicureFlag( pictureFlag() ); + smt->go( true ); +} + +void Client::setChatSessionState( const QString &to, bool close ) +{ + ChatSessionTask *cst = new ChatSessionTask( d->root ); + cst->setTarget( to ); + cst->setType( close ? ChatSessionTask::UnregisterSession : ChatSessionTask::RegisterSession ); + cst->go( true ); +} + +void Client::sendBuzz( const QString &to ) +{ + SendMessageTask *smt = new SendMessageTask( d->root ); + smt->setTarget( to ); + smt->setText( QString::fromLatin1( "<ding>" ) ); + smt->setPicureFlag( pictureFlag() ); + smt->go( true ); +} + +void Client::sendFile( unsigned int transferId, const QString &to, const QString &msg, KURL url ) +{ + SendFileTask *sft = new SendFileTask( d->root ); + + QObject::connect( sft, SIGNAL(complete(unsigned int)), SIGNAL(fileTransferComplete(unsigned int)) ); + QObject::connect( sft, SIGNAL(bytesProcessed(unsigned int, unsigned int)), SIGNAL(fileTransferBytesProcessed(unsigned int, unsigned int)) ); + QObject::connect( sft, SIGNAL(error(unsigned int, int, const QString &)), SIGNAL(fileTransferError(unsigned int, int, const QString &)) ); + + QObject::connect( this, SIGNAL(fileTransferCanceled( unsigned int )), sft, SLOT(canceled( unsigned int )) ); + + sft->setTarget( to ); + sft->setMessage( msg ); + sft->setFileUrl( url ); + sft->setTransferId( transferId ); + sft->go( true ); +} + +void Client::receiveFile( unsigned int transferId, const QString &userId, KURL remoteURL, KURL localURL ) +{ + ReceiveFileTask *rft = new ReceiveFileTask( d->root ); + + QObject::connect( rft, SIGNAL(complete(unsigned int)), SIGNAL(fileTransferComplete(unsigned int)) ); + QObject::connect( rft, SIGNAL(bytesProcessed(unsigned int, unsigned int)), SIGNAL(fileTransferBytesProcessed(unsigned int, unsigned int)) ); + QObject::connect( rft, SIGNAL(error(unsigned int, int, const QString &)), SIGNAL(fileTransferError(unsigned int, int, const QString &)) ); + QObject::connect( this, SIGNAL(fileTransferCanceled( unsigned int )), rft, SLOT(canceled( unsigned int )) ); + + rft->setRemoteUrl( remoteURL ); + rft->setLocalUrl( localURL ); + rft->setTransferId( transferId ); + rft->setUserId( userId ); + if( remoteURL.url().startsWith( "http://" ) ) + rft->setType( ReceiveFileTask::FileTransferAccept ); + else + rft->setType( ReceiveFileTask::FileTransfer7Accept ); + rft->go( true ); +} + +void Client::rejectFile( const QString &userId, KURL remoteURL ) +{ + if( remoteURL.url().startsWith( "http://" ) ) + return; + + ReceiveFileTask *rft = new ReceiveFileTask( d->root ); + + rft->setRemoteUrl( remoteURL ); + rft->setUserId( userId ); + rft->setType( ReceiveFileTask::FileTransfer7Reject ); + rft->go( true ); +} + +void Client::cancelFileTransfer( unsigned int transferId ) +{ + emit fileTransferCanceled( transferId ); +} + +void Client::changeStatus( Yahoo::Status status, const QString &message, Yahoo::StatusType type ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "status: " << status + << " message: " << message + << " type: " << type << endl; + ChangeStatusTask *cst = new ChangeStatusTask( d->root ); + cst->setStatus( status ); + cst->setMessage( message ); + cst->setType( type ); + cst->go( true ); + + if( status == Yahoo::StatusInvisible ) + stealthContact( QString::null, Yahoo::StealthOnline, Yahoo::StealthClear ); + + setStatus( status ); +} + +void Client::sendAuthReply( const QString &userId, bool accept, const QString &msg ) +{ + SendAuthRespTask *sarp = new SendAuthRespTask( d->root ); + sarp->setGranted( accept ); + sarp->setTarget( userId ); + sarp->setMessage( msg ); + sarp->go( true ); +} + +void Client::sendPing() +{ + if( !d->active ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Disconnected. NOT sending a PING." << endl; + return; + } + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Sending a PING." << endl; + PingTask *pt = new PingTask( d->root ); + pt->go( true ); +} + +// ***** Contactlist handling ***** + +void Client::stealthContact(QString const &userId, Yahoo::StealthMode mode, Yahoo::StealthStatus state) +{ + StealthTask *st = new StealthTask( d->root ); + st->setTarget( userId ); + st->setState( state ); + st->setMode( mode ); + st->go( true ); +} + +void Client::addBuddy( const QString &userId, const QString &group, const QString &message ) +{ + ModifyBuddyTask *mbt = new ModifyBuddyTask( d->root ); + mbt->setType( ModifyBuddyTask::AddBuddy ); + mbt->setTarget( userId ); + mbt->setGroup( group ); + mbt->setMessage( message ); + mbt->go( true ); +} + +void Client::removeBuddy( const QString &userId, const QString &group ) +{ + ModifyBuddyTask *mbt = new ModifyBuddyTask( d->root ); + mbt->setType( ModifyBuddyTask::RemoveBuddy ); + mbt->setTarget( userId ); + mbt->setGroup( group ); + mbt->go( true ); +} + +void Client::moveBuddy( const QString &userId, const QString &oldGroup, const QString &newGroup ) +{ + ModifyBuddyTask *mbt = new ModifyBuddyTask( d->root ); + mbt->setType( ModifyBuddyTask::MoveBuddy ); + mbt->setTarget( userId ); + mbt->setOldGroup( oldGroup ); + mbt->setGroup( newGroup ); + mbt->go( true ); +} + +// ***** Buddyicon handling ***** + +void Client::requestPicture( const QString &userId ) +{ + RequestPictureTask *rpt = new RequestPictureTask( d->root ); + rpt->setTarget( userId ); + rpt->go( true ); +} + +void Client::downloadPicture( const QString &userId, KURL url, int checksum ) +{ + if( !d->iconLoader ) + { + d->iconLoader = new YahooBuddyIconLoader( this ); + QObject::connect( d->iconLoader, SIGNAL(fetchedBuddyIcon(const QString&, KTempFile*, int )), + SIGNAL(pictureDownloaded(const QString&, KTempFile*, int ) ) ); + } + + d->iconLoader->fetchBuddyIcon( QString(userId), KURL(url), checksum ); +} + +void Client::uploadPicture( KURL url ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "URL: " << url.url() << endl; + SendPictureTask *spt = new SendPictureTask( d->root ); + spt->setType( SendPictureTask::UploadPicture ); + spt->setFilename( url.fileName() ); + if ( url.isLocalFile() ) + spt->setPath( url.path() ); + else + spt->setPath( url.url() ); + d->pictureFlag = 2; + spt->go( true ); +} + +void Client::sendPictureChecksum( int checksum, const QString &who ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "checksum: " << checksum << endl; + SendPictureTask *spt = new SendPictureTask( d->root ); + spt->setType( SendPictureTask::SendChecksum ); + spt->setChecksum( checksum ); + if( !who.isEmpty() ) + spt->setTarget( who ); + spt->go( true ); +} + +void Client::sendPictureInformation( const QString &userId, const QString &url, int checksum ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "checksum: " << checksum << endl; + SendPictureTask *spt = new SendPictureTask( d->root ); + spt->setType( SendPictureTask::SendInformation ); + spt->setChecksum( checksum ); + spt->setUrl( url ); + spt->setTarget( userId ); + spt->go( true ); +} + +void Client::sendPictureStatusUpdate( const QString &userId, int type ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Setting PictureStatus to: " << type << endl; + SendPictureTask *spt = new SendPictureTask( d->root ); + spt->setType( SendPictureTask::SendStatus ); + spt->setStatus( type ); + spt->setTarget( userId ); + spt->go( true ); +} + +// ***** Webcam handling ***** + +void Client::requestWebcam( const QString &userId ) +{ + d->webcamTask->requestWebcam( userId ); +} + +void Client::closeWebcam( const QString &userId ) +{ + d->webcamTask->closeWebcam( userId ); +} + +void Client::sendWebcamImage( const QByteArray &ar ) +{ + d->webcamTask->sendWebcamImage( ar ); +} + +void Client::closeOutgoingWebcam() +{ + d->webcamTask->closeOutgoingWebcam(); +} + + +void Client::grantWebcamAccess( const QString &userId ) +{ + d->webcamTask->grantAccess( userId ); +} + +// ***** Conferences ***** +void Client::inviteConference( const QString &room, const QStringList &members, const QString &msg ) +{ + d->conferenceTask->inviteConference( room, members, msg ); +} + +void Client::addInviteConference( const QString &room, const QStringList &who, const QStringList &members, const QString &msg ) +{ + d->conferenceTask->addInvite( room, who, members, msg ); +} + +void Client::joinConference( const QString &room, const QStringList &members ) +{ + d->conferenceTask->joinConference( room, members ); +} + +void Client::declineConference( const QString &room, const QStringList &members, const QString &msg ) +{ + d->conferenceTask->declineConference( room, members, msg ); +} + +void Client::leaveConference( const QString &room, const QStringList &members ) +{ + d->conferenceTask->leaveConference( room, members ); +} + +void Client::sendConferenceMessage( const QString &room, const QStringList &members, const QString &msg ) +{ + d->conferenceTask->sendMessage( room, members, msg ); +} + +// ***** YAB ***** +void Client::getYABEntries( long lastMerge, long lastRemoteRevision ) +{ + d->yabTask->getAllEntries( lastMerge, lastRemoteRevision); +} + +void Client::saveYABEntry( YABEntry &entry ) +{ + ModifyYABTask *myt = new ModifyYABTask( d->root ); + myt->setAction( ModifyYABTask::EditEntry ); + myt->setEntry( entry ); + QObject::connect( myt, SIGNAL(gotEntry( YABEntry * )), this, SIGNAL( gotYABEntry( YABEntry * ) ) ); + QObject::connect( myt, SIGNAL(error( YABEntry *, const QString &)), this, SIGNAL(modifyYABEntryError( YABEntry *, const QString & ))); + myt->go(true); +} + +void Client::addYABEntry( YABEntry &entry ) +{ + ModifyYABTask *myt = new ModifyYABTask( d->root ); + myt->setAction( ModifyYABTask::AddEntry ); + myt->setEntry( entry ); + QObject::connect( myt, SIGNAL(gotEntry( YABEntry * )), this, SIGNAL( gotYABEntry( YABEntry * ) ) ); + QObject::connect( myt, SIGNAL(error( YABEntry *, const QString &)), this, SIGNAL(modifyYABEntryError( YABEntry *, const QString & ))); + myt->go(true); +} + +void Client::deleteYABEntry( YABEntry &entry ) +{ + ModifyYABTask *myt = new ModifyYABTask( d->root ); + myt->setAction( ModifyYABTask::DeleteEntry ); + myt->setEntry( entry ); + myt->go(true); +} + +// ***** other ***** +void Client::notifyError( const QString &info, const QString & errorString, LogLevel level ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << QString::fromLatin1("\nThe following error occured: %1\n Reason: %2\n LogLevel: %3") + .arg(info).arg(errorString).arg(level) << endl; + d->errorString = errorString; + d->errorInformation = info; + emit error( level ); +} + +QString Client::userId() +{ + return d->user; +} + +void Client::setUserId( const QString & userId ) +{ + d->user = userId; +} + +Yahoo::Status Client::status() +{ + return d->status; +} + +void Client::setStatus( Yahoo::Status status ) +{ + d->status = status; +} + + +void Client::setStatusOnConnect( Yahoo::Status status ) +{ + d->statusOnConnect = status; +} + +void Client::setStatusMessageOnConnect( const QString &msg ) +{ + d->statusMessageOnConnect = msg; +} + +void Client::setVerificationWord( const QString &word ) +{ + d->loginTask->setVerificationWord( word ); +} + +QString Client::password() +{ + return d->pass; +} + +QCString Client::ipAddress() +{ + //TODO determine ip address + return "127.0.0.1"; +} + +QString Client::host() +{ + return d->host; +} + +int Client::port() +{ + return d->port; +} + +uint Client::sessionID() +{ + return d->sessionID; +} + +int Client::pictureFlag() +{ + return d->pictureFlag; +} + +void Client::setPictureFlag( int flag ) +{ + d->pictureFlag = flag; +} + +QString Client::yCookie() +{ + return d->yCookie; +} + +QString Client::tCookie() +{ + return d->tCookie; +} + +QString Client::cCookie() +{ + return d->cCookie; +} + +void Client::distribute( Transfer * transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + if( !rootTask()->take( transfer ) ) + kdDebug(YAHOO_RAW_DEBUG) << "CLIENT: root task refused transfer" << endl; + delete transfer; +} + +void Client::send( Transfer* request ) +{ + kdDebug(YAHOO_RAW_DEBUG) << "CLIENT::send()"<< endl; + if( !d->stream ) + { + kdDebug(YAHOO_RAW_DEBUG) << "CLIENT - NO STREAM TO SEND ON!" << endl; + return; + } + + d->stream->write( request ); +} + +void Client::debug(const QString &str) +{ + qDebug( "CLIENT: %s", str.ascii() ); +} + +Task * Client::rootTask() +{ + return d->root; +} + +void Client::initTasks() +{ + if( d->tasksInitialized ) + return; + + d->statusTask = new StatusNotifierTask( d->root ); + QObject::connect( d->statusTask, SIGNAL( statusChanged( const QString&, int, const QString&, int, int ) ), + SIGNAL( statusChanged( const QString&, int, const QString&, int, int ) ) ); + QObject::connect( d->statusTask, SIGNAL( stealthStatusChanged( const QString&, Yahoo::StealthStatus ) ), + SIGNAL( stealthStatusChanged( const QString&, Yahoo::StealthStatus ) ) ); + QObject::connect( d->statusTask, SIGNAL( loginResponse( int, const QString& ) ), + SLOT( slotLoginResponse( int, const QString& ) ) ); + QObject::connect( d->statusTask, SIGNAL( authorizationRejected( const QString&, const QString& ) ), + SIGNAL( authorizationRejected( const QString&, const QString& ) ) ); + QObject::connect( d->statusTask, SIGNAL( authorizationAccepted( const QString& ) ), + SIGNAL( authorizationAccepted( const QString& ) ) ); + QObject::connect( d->statusTask, SIGNAL( gotAuthorizationRequest( const QString &, const QString &, const QString & ) ), + SIGNAL( gotAuthorizationRequest( const QString &, const QString &, const QString & ) ) ); + QObject::connect( d->statusTask, SIGNAL( gotPictureChecksum( const QString &, int ) ), + SIGNAL( pictureChecksumNotify( const QString &, int ) ) ); + + d->mailTask = new MailNotifierTask( d->root ); + QObject::connect( d->mailTask, SIGNAL( mailNotify(const QString&, const QString&, int) ), + SIGNAL( mailNotify(const QString&, const QString&, int) ) ); + + d->messageReceiverTask = new MessageReceiverTask( d->root ); + QObject::connect( d->messageReceiverTask, SIGNAL( gotIm(const QString&, const QString&, long, int) ), + SIGNAL( gotIm(const QString&, const QString&, long, int) ) ); + QObject::connect( d->messageReceiverTask, SIGNAL( systemMessage(const QString&) ), + SIGNAL( systemMessage(const QString&) ) ); + QObject::connect( d->messageReceiverTask, SIGNAL( gotTypingNotify(const QString &, int) ), + SIGNAL( typingNotify(const QString &, int) ) ); + QObject::connect( d->messageReceiverTask, SIGNAL( gotBuzz( const QString &, long ) ), + SIGNAL( gotBuzz( const QString &, long ) ) ); + QObject::connect( d->messageReceiverTask, SIGNAL( gotWebcamInvite(const QString &) ), + SIGNAL( gotWebcamInvite(const QString &) ) ); + + d->pictureNotifierTask = new PictureNotifierTask( d->root ); + QObject::connect( d->pictureNotifierTask, SIGNAL( pictureStatusNotify( const QString &, int ) ), + SIGNAL( pictureStatusNotify( const QString &, int ) ) ); + QObject::connect( d->pictureNotifierTask, SIGNAL( pictureChecksumNotify( const QString &, int ) ), + SIGNAL( pictureChecksumNotify( const QString &, int ) ) ); + QObject::connect( d->pictureNotifierTask, SIGNAL( pictureInfoNotify( const QString &, KURL, int ) ), + SIGNAL( pictureInfoNotify( const QString &, KURL, int ) ) ); + QObject::connect( d->pictureNotifierTask, SIGNAL( pictureRequest( const QString & ) ), + SIGNAL( pictureRequest( const QString & ) ) ); + QObject::connect( d->pictureNotifierTask, SIGNAL( pictureUploaded( const QString & ) ), + SIGNAL( pictureUploaded( const QString & ) ) ); + + d->webcamTask = new WebcamTask( d->root ); + QObject::connect( d->webcamTask, SIGNAL( webcamImageReceived( const QString &, const QPixmap &) ), + SIGNAL( webcamImageReceived( const QString &, const QPixmap &) ) ); + QObject::connect( d->webcamTask, SIGNAL( webcamNotAvailable( const QString & ) ), + SIGNAL( webcamNotAvailable( const QString & ) ) ); + QObject::connect( d->webcamTask, SIGNAL( webcamClosed( const QString &, int ) ), + SIGNAL( webcamClosed( const QString &, int ) ) ); + QObject::connect( d->webcamTask, SIGNAL( webcamPaused(const QString&) ), + SIGNAL( webcamPaused(const QString&) ) ); + QObject::connect( d->webcamTask, SIGNAL( readyForTransmission() ), + SIGNAL( webcamReadyForTransmission() ) ); + QObject::connect( d->webcamTask, SIGNAL( stopTransmission() ), + SIGNAL( webcamStopTransmission() ) ); + QObject::connect( d->webcamTask, SIGNAL( viewerJoined( const QString &) ), + SIGNAL( webcamViewerJoined( const QString &) ) ); + QObject::connect( d->webcamTask, SIGNAL( viewerLeft( const QString &) ), + SIGNAL( webcamViewerLeft( const QString &) ) ); + QObject::connect( d->webcamTask, SIGNAL( viewerRequest( const QString &) ), + SIGNAL( webcamViewerRequest( const QString &) ) ); + + d->conferenceTask = new ConferenceTask( d->root ); + QObject::connect( d->conferenceTask, SIGNAL( gotInvite( const QString &, const QString &, const QString &, const QStringList & ) ), + SIGNAL( gotConferenceInvite( const QString &, const QString &, const QString &, const QStringList & ) ) ); + QObject::connect( d->conferenceTask, SIGNAL( gotMessage( const QString &, const QString &, const QString & ) ), + SIGNAL( gotConferenceMessage( const QString &, const QString &, const QString & ) ) ); + QObject::connect( d->conferenceTask, SIGNAL( userJoined( const QString &, const QString & ) ), + SIGNAL( confUserJoined( const QString &, const QString & ) ) ); + QObject::connect( d->conferenceTask, SIGNAL( userLeft( const QString &, const QString & ) ), + SIGNAL( confUserLeft( const QString &, const QString & ) ) ); + QObject::connect( d->conferenceTask, SIGNAL( userDeclined( const QString &, const QString &, const QString & ) ), + SIGNAL( confUserDeclined( const QString &, const QString &, const QString & ) ) ); + + d->yabTask = new YABTask( d->root ); + QObject::connect( d->yabTask, SIGNAL( gotEntry( YABEntry * ) ), + SIGNAL( gotYABEntry( YABEntry * ) ) ); + QObject::connect( d->yabTask, SIGNAL( gotRevision( long, bool ) ), + SIGNAL( gotYABRevision( long, bool ) ) ); + + d->fileTransferTask = new FileTransferNotifierTask( d->root ); + QObject::connect( d->fileTransferTask, SIGNAL(incomingFileTransfer( const QString &, const QString &, + long, const QString &, const QString &, unsigned long )), + SIGNAL(incomingFileTransfer( const QString &, const QString &, + long, const QString &, const QString &, unsigned long )) ); +} + +void Client::deleteTasks() +{ + d->tasksInitialized = false; + d->statusTask->deleteLater(); + d->statusTask = 0L; + d->mailTask->deleteLater(); + d->mailTask = 0L; + d->messageReceiverTask->deleteLater(); + d->messageReceiverTask = 0L; + d->pictureNotifierTask->deleteLater(); + d->pictureNotifierTask = 0L; + d->webcamTask->deleteLater(); + d->webcamTask = 0L; + d->conferenceTask->deleteLater(); + d->conferenceTask = 0L; + d->yabTask->deleteLater(); + d->yabTask = 0L; + d->fileTransferTask->deleteLater(); + d->fileTransferTask = 0; +} + +#include "client.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/client.h b/kopete/protocols/yahoo/libkyahoo/client.h new file mode 100644 index 00000000..711336f0 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/client.h @@ -0,0 +1,618 @@ +/* + Kopete Yahoo Protocol + + Copyright (c) 2005-2006 André Duffeck <[email protected]> + Copyright (c) 2004 Duncan Mac-Vicar P. <[email protected]> + Copyright (c) 2004 Matt Rogers <[email protected]> + Copyright (c) 2004 SuSE Linux AG <http://www.suse.com> + Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 LIBYAHOO_CLIENT_H +#define LIBYAHOO_CLIENT_H + +#include <qobject.h> + +#include "transfer.h" +#include "yahootypes.h" + +#define YMSG_PROGRAM_VERSION_STRING "7,5,0,33" + +class QString; +class QTimer; +class ClientStream; +class KNetworkConnector; +class Task; +class KURL; +class KTempFile; +class YABEntry; +class SendFileTask; + +class Client : public QObject +{ +Q_OBJECT + + public: + + /************* + EXTERNAL API + *************/ + + enum LogLevel { Debug, Info, Notice, Warning, Error, Critical }; + + Client(QObject *parent=0); + ~Client(); + void setUserId( const QString& userName ); + + /** + * Start a connection to the server using the supplied @ref ClientStream. + * This is only a transport layer connection. + * Needed for protocol action P1. + * @param s initialised client stream to use for the connection. + * @param server the server to connect to - but this is also set on the connector used to construct the clientstream?? + * @param auth indicate whether we're connecting to the authorizer or the bos server + */ + void connect( const QString &host, const uint port, const QString &userId, const QString &pass ); + + /** + * Cancel active login attemps + */ + void cancelConnect(); + + /** + * Logout and disconnect + */ + void close(); + + /** + * Returns the errorcode + */ + int error(); + + /** + * Returns a description of the error + */ + QString errorString(); + + /** + * Returns information about what went wrong + */ + QString errorInformation(); + + /** + * Specifies the status we connect with. + * The Yahoo protocol supports connecting into Online and Invisible state. + * If status is any other status the Client connects into Online state and changes into the specified state after the login. + * @param status the status to connect with + */ + void setStatusOnConnect( Yahoo::Status status ); + + /** + * Specifies the status message we connect with. + * The Yahoo protocol does not support connecting with a status message. If msg is not empty the Client + * will change the status message after the login. + * @param msg the status message to connect with + */ + void setStatusMessageOnConnect( const QString &msg ); + + /** + * Accessors needed for login + */ + QString host(); + int port(); + + /** + * return the pictureFlag describing the status of our buddy icon + * 0 = no icon, 2 = icon, 1 = avatar (?) + */ + int pictureFlag(); + + /** + * set the pictureFlag describing the status of our buddy icon + */ + void setPictureFlag( int flag ); + + /** + * Send a Typing notification + * @param to the buddy that should be notified + * @param typing true if there is typing activity, false if not + */ + void sendTyping( const QString &to, bool typing ); + + /** + * Send a Message + * @param to the buddy that should receive the message + * @param msg the message + */ + void sendMessage( const QString &to, const QString &msg ); + + /** + * Register / Unregister a chatsession + * @param to the buddy, the chatsession belongs to + * @param close if true, the chatsession will be closed, if false, it will be opened + */ + void setChatSessionState( const QString &to, bool close ); + + /** + * Send a Buzz + * @param to the buddy that should receive the buzz + */ + void sendBuzz( const QString &to ); + + /** + * Change our status + * @param status the status that will be set + * @param message the status message that will be set + * @param type Yahoo::StatusTypeAvailable means that the user is available, Yahoo::StatusTypeAway means that the user is away from the keyboard + */ + void changeStatus(Yahoo::Status status, const QString &message, Yahoo::StatusType type); + + /** + * Set the verification word that is needed for a account verification after + * too many wrong login attempts. + * @param word the verification word + */ + void setVerificationWord( const QString &word ); + + /** + * Add a buddy to the contact list + * @param userId the yahoo ID of the buddy that should be added + * @param group the group where the buddy will be placed + * @param message the message that will be sent to the buddy along the authorization request + */ + void addBuddy( const QString &userId, const QString &group, const QString &message = QString::fromLatin1("Please add me") ); + + /** + * Remove a buddy from the contact list + */ + void removeBuddy( const QString &userId, const QString &group ); + + /** + * Move a buddy into another group + */ + void moveBuddy( const QString &userId, const QString &oldGroup, const QString &newGroup ); + + /** + * Change the stealth status of a buddy + */ + void stealthContact( QString const &userId, Yahoo::StealthMode mode, Yahoo::StealthStatus state ); + + /** + * Request the buddy's picture + */ + void requestPicture( const QString &userId ); + + /** + * Download the buddy's picture + */ + void downloadPicture( const QString &userId, KURL url, int checksum ); + + /** + * Send our picture + */ + void uploadPicture( KURL url ); + + /** + * Send checksum of our picture + */ + void sendPictureChecksum( int checksum, const QString & ); + + /** + * Send information about our picture + */ + void sendPictureInformation( const QString &userId, const QString &url, int checksum ); + + /** + * Notify the buddies about our new status + */ + void sendPictureStatusUpdate( const QString &userId, int type ); + + /** + * Send a response to the webcam invite ( Accept / Decline ) + */ + void requestWebcam( const QString &userId ); + + /** + * Stop receiving of webcam + */ + void closeWebcam( const QString &userId ); + + /** + * Invite the user to view your Webcam + */ + void sendWebcamInvite( const QString &userId ); + + /** + * transmit a new image to the watchers + */ + void sendWebcamImage( const QByteArray &image ); + + /** + * Stop transmission + */ + void closeOutgoingWebcam(); + + /** + * Allow a buddy to watch the cam + */ + void grantWebcamAccess( const QString &userId ); + + /** + * Invite buddies to a conference + */ + void inviteConference( const QString &room, const QStringList &members, const QString &msg ); + + /** + * Invite buddies to a already existing conference + */ + void addInviteConference( const QString &room, const QStringList &who, const QStringList &members, const QString &msg ); + + /** + * Join a conference + */ + void joinConference( const QString &room, const QStringList &members ); + + /** + * Decline to join a conference + */ + void declineConference( const QString &room, const QStringList &members, const QString &msg ); + + /** + * Leave the conference + */ + void leaveConference( const QString &room, const QStringList &members ); + + /** + * Send a message to the conference + */ + void sendConferenceMessage( const QString &room, const QStringList &members, const QString &msg ); + + /** + * Send a authorization request response + */ + void sendAuthReply( const QString &userId, bool accept, const QString &msg ); + + /** + * Fetches all entries of the YAB + */ + void getYABEntries( long lastMerge, long lastRemoteRevision ); + + /** + * Saves a modified YAB entry + */ + void saveYABEntry( YABEntry &entry ); + + /** + * Creates a new YAB entry + */ + void addYABEntry( YABEntry &entry ); + + /** + * Deletes a YAB entry + */ + void deleteYABEntry( YABEntry &entry ); + + /** + * Send a file to a buddy + */ + void sendFile( unsigned int transferId, const QString &userId, const QString &msg, KURL url ); + + /** + * Receive a file from a buddy + */ + void receiveFile( unsigned int transferId, const QString &userId, KURL remoteURL, KURL localURL ); + + /** + * Reject a file offered by a buddy + */ + void rejectFile( const QString &userId, KURL remoteURL ); + + /** + * The user canceled the filetransfer + */ + void cancelFileTransfer( unsigned int transferId ); + + /************* + INTERNAL (FOR USE BY TASKS) METHODS + *************/ + /** + * Send an outgoing request to the server + */ + void send( Transfer *request ); + + /** + * Print a debug statement + */ + void debug( const QString &str ); + + /** + * The current user's user ID + */ + QString userId(); + + /** + * The current user's password + */ + QString password(); + + /** + * Host's IP address + */ + QCString ipAddress(); + + /** + * current Session ID + */ + uint sessionID(); + + /** + * Get our status + */ + Yahoo::Status status(); + + /** + * Set our status + */ + void setStatus( Yahoo::Status ); + + /** + * Access the root Task for this client, so tasks may be added to it. + */ + Task* rootTask(); + + /** + * Accessors to the cookies + */ + QString yCookie(); + QString tCookie(); + QString cCookie(); + + /** + * Error + */ + void notifyError( const QString &info, const QString &errorString, LogLevel level ); + signals: + /** CONNECTION EVENTS */ + /** + * Notifies that the login process has succeeded. + */ + void loggedIn( int, const QString& ); + + /** + * Notifies that the login process has failed + */ + void loginFailed(); + + /** + * Notifies tasks and account so they can react properly + */ + void connected(); + /** + * Notifies tasks and account so they can react properly + */ + void disconnected(); + /** + * We were disconnected because we connected elsewhere + */ + void connectedElsewhere(); + + void error( int level ); + /** + * Notifies about our buddies and groups + */ + void gotBuddy( const QString &, const QString &, const QString & ); + /** + * Notifies about the status of online buddies + */ + void statusChanged( const QString&, int, const QString&, int, int ); + /** + * Notifies about the stealth status of buddies + */ + void stealthStatusChanged( const QString &, Yahoo::StealthStatus ); + /** + * Notifies about mails + */ + void mailNotify( const QString&, const QString&, int ); + /** + * We got a new message + */ + void gotIm( const QString&, const QString&, long, int ); + /** + * We got a new system message + */ + void systemMessage( const QString& ); + /** + * The buddy is typing a message + */ + void typingNotify( const QString &, int ); + /** + * The buddy has invited us to view his webcam + */ + void gotWebcamInvite(const QString &); + /** + * Notifies about a BUZZ notification + */ + void gotBuzz( const QString &, long ); + /** + * Notifies about a changed picture status + */ + void pictureStatusNotify( const QString &, int ); + /** + * Notifies about a picture checksum + */ + void pictureChecksumNotify( const QString &, int ); + /** + * Notifies about a picture + */ + void pictureInfoNotify( const QString &, KURL, int ); + /** + * The iconLoader has successfully downloaded a picutre + */ + void pictureDownloaded( const QString &, KTempFile *, int ); + /** + * A Buddy asks for our picture + */ + void pictureRequest( const QString & ); + /** + * Information about the picture upload + */ + void pictureUploaded( const QString & ); + /** + * We've received a webcam image from a buddy + */ + void webcamImageReceived( const QString &, const QPixmap &); + /** + * The requested Webcam is not available + */ + void webcamNotAvailable( const QString & ); + /** + * The connection to the webcam was closed + */ + void webcamClosed( const QString &, int ); + /** + * The webcamtransmission is paused + */ + void webcamPaused(const QString&); + /** + * The webcam connection is ready for transmission + */ + void webcamReadyForTransmission(); + /** + * The webcam should stop sending images + */ + void webcamStopTransmission(); + /** + * A new buddy watches the cam + */ + void webcamViewerJoined( const QString & ); + /** + * A buddy no longer watches the cam + */ + void webcamViewerLeft( const QString & ); + /** + * A buddy wants to watch the cam + */ + void webcamViewerRequest( const QString & ); + /** + * A buddy invited us to a conference + */ + void gotConferenceInvite( const QString &, const QString &, const QString &, const QStringList & ); + /** + * A conference message was received + */ + void gotConferenceMessage( const QString &, const QString &, const QString & ); + /** + * A buddy joined the conference + */ + void confUserJoined( const QString &, const QString & ); + /** + * A buddy left the conference + */ + void confUserLeft( const QString &, const QString & ); + /** + * A buddy declined to join the conference + */ + void confUserDeclined( const QString &, const QString &, const QString & ); + /** + * A buddy accepted our authorization request + */ + void authorizationAccepted( const QString & ); + /** + * A buddy rejected our authorization request + */ + void authorizationRejected( const QString &, const QString & ); + /** + * A buddy requests authorization + */ + void gotAuthorizationRequest( const QString &, const QString &, const QString & ); + /** + * A revision of the Yahoo Addressbook was received + */ + void gotYABRevision( long rev, bool merged ); + /** + * A entry from the Yahoo Addressbook was retrieved + */ + void gotYABEntry( YABEntry * ); + /** + * An error occured while saving a Yahoo Addressbook entry + */ + void modifyYABEntryError( YABEntry *, const QString & ); + /** + * number of Bytes transferred for FileTransfer id + */ + void fileTransferBytesProcessed( unsigned int, unsigned int ); + /** + * filetransfer completed + */ + void fileTransferComplete( unsigned int ); + /** + * An error occured during the filetransfer + */ + void fileTransferError( unsigned int, int, const QString & ); + /** + * filetransfer canceled + */ + void fileTransferCanceled( unsigned int ); + /** + * A buddy is trying to send us a file + */ + void incomingFileTransfer( const QString &, const QString &, long, const QString &, + const QString &, unsigned long ); + protected slots: + // INTERNAL, FOR USE BY TASKS' finished() SIGNALS // + void lt_loginFinished(); + void lt_gotSessionID( uint ); + void cs_connected(); + void slotGotCookies(); + + /** + * Used by tasks to identify a response to a login attempt + */ + void slotLoginResponse( int, const QString& ); + + /** + * Used by the client stream to notify errors to upper layers. + */ + void streamError( int error ); + + /** + * The client stream has data ready to read. + */ + void streamReadyRead(); + + /** + * Send a Yahoo Ping packet to the server + */ + void sendPing(); + private: + void distribute( Transfer *transfer ); + + /** + * create static tasks and connect their signals + */ + void initTasks(); + + /** + * remove static tasks and their singal connections + */ + void deleteTasks(); + + class ClientPrivate; + ClientPrivate* d; + KNetworkConnector *m_connector; + + QTimer *m_pingTimer; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/conferencetask.cpp b/kopete/protocols/yahoo/libkyahoo/conferencetask.cpp new file mode 100644 index 00000000..5f68eaa0 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/conferencetask.cpp @@ -0,0 +1,259 @@ +/* + Kopete Yahoo Protocol + Handles conferences + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "conferencetask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <qstringlist.h> +#include <kdebug.h> + +ConferenceTask::ConferenceTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +ConferenceTask::~ConferenceTask() +{ +} + +bool ConferenceTask::take( Transfer* transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if ( !forMe( transfer ) ) + return false; + + YMSGTransfer *t = 0L; + t = static_cast<YMSGTransfer*>(transfer); + + if( t->service() == Yahoo::ServiceConfInvite || + t->service() == Yahoo::ServiceConfAddInvite) + parseInvitation( t ); + else if( t->service() == Yahoo::ServiceConfMsg ) + parseMessage( t ); + else if( t->service() == Yahoo::ServiceConfLogon ) + parseUserJoined( t ); + else if( t->service() == Yahoo::ServiceConfLogoff ) + parseUserLeft( t ); + else if( t->service() == Yahoo::ServiceConfDecline ) + parseUserDeclined( t ); + + return true; +} + +bool ConferenceTask::forMe( Transfer* transfer ) const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + if ( t->service() == Yahoo::ServiceConfInvite || + t->service() == Yahoo::ServiceConfLogon || + t->service() == Yahoo::ServiceConfDecline || + t->service() == Yahoo::ServiceConfLogoff || + t->service() == Yahoo::ServiceConfAddInvite || + t->service() == Yahoo::ServiceConfMsg ) + return true; + else + return false; +} + +void ConferenceTask::parseInvitation( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + int i = 0; + QString who = t->firstParam( 50 ); + QString room = t->firstParam( 57 ); + bool utf = QString( t->firstParam( 97 ) ).toInt() == 1; + QString msg; + if( utf ) + msg = QString::fromUtf8( t->firstParam( 58 ) ); + else + msg = t->firstParam( 58 ); + + QStringList members; + for( i = 0; i < t->paramCount( 52 ); i++ ) + members.append( t->nthParam( 52, i ) ); + for( i = 0; i < t->paramCount( 53 ); i++ ) + members.append( t->nthParam( 53, i ) ); + if( who == client()->userId() ) + return; + + if( !who.isEmpty() && !room.isEmpty() ) + emit gotInvite( who, room, msg, members ); +} + +void ConferenceTask::parseMessage( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString room = t->firstParam( 57 ); + QString from = t->firstParam( 3 ); + bool utf = QString( t->firstParam( 97 ) ).toInt() == 1; + QString msg; + if( utf ) + msg = QString::fromUtf8( t->firstParam( 14 ) ); + else + msg = t->firstParam( 14 ); + + if( !msg.isEmpty() ) + emit gotMessage( from, room, msg ); +} + +void ConferenceTask::parseUserJoined( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString room = t->firstParam( 57 ); + QString who = t->firstParam( 53 ); + + if( !who.isEmpty() && !room.isEmpty() ) + emit userJoined( who, room ); +} + +void ConferenceTask::parseUserLeft( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString room = t->firstParam( 57 ); + QString who = t->firstParam( 56 ); + + if( !who.isEmpty() && !room.isEmpty() ) + emit userLeft( who, room ); +} + +void ConferenceTask::parseUserDeclined( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString room = t->firstParam( 57 ); + QString who = t->firstParam( 54 ); + QString msg = t->firstParam( 14 ); + + if( !who.isEmpty() && !room.isEmpty() ) + emit userDeclined( who, room, msg ); +} + +void ConferenceTask::inviteConference( const QString &room, const QStringList &members, const QString &msg ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfInvite); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + t->setParam( 50, client()->userId().local8Bit() ); + t->setParam( 57, room.local8Bit() ); + t->setParam( 58, msg.local8Bit() ); + t->setParam( 97, 1 ); + for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + t->setParam( 52, (*it).local8Bit() ); + t->setParam( 13, "0" ); + + send( t ); +} + +void ConferenceTask::addInvite( const QString &room, const QStringList &who, const QStringList &members, const QString &msg ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfAddInvite); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + + QString whoList = who.first(); + for( uint i = 1; i < who.size(); i++ ) + whoList += QString(",%1").arg( who[i] ); + t->setParam( 51, whoList.local8Bit() ); + + t->setParam( 57, room.local8Bit() ); + t->setParam( 58, msg.local8Bit() ); + t->setParam( 97, 1 ); + for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + { + t->setParam( 52, (*it).local8Bit() ); + t->setParam( 53, (*it).local8Bit() ); // Note: this field should only be set if the buddy has already joined the conference, but no harm is done this way + } + t->setParam( 13, "0" ); + + send( t ); +} + +void ConferenceTask::joinConference( const QString &room, const QStringList &members ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfLogon); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + t->setParam( 3, (*it).local8Bit() ); + t->setParam( 57, room.local8Bit() ); + + send( t ); +} + +void ConferenceTask::declineConference( const QString &room, const QStringList &members, const QString &msg ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfDecline); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + t->setParam( 3, (*it).local8Bit() ); + t->setParam( 57, room.local8Bit() ); + t->setParam( 14, msg.utf8() ); + t->setParam( 97, 1 ); + + send( t ); +} +void ConferenceTask::leaveConference( const QString &room, const QStringList &members ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfLogoff); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + t->setParam( 3, (*it).local8Bit() ); + t->setParam( 57, room.local8Bit() ); + + send( t ); +} + +void ConferenceTask::sendMessage( const QString &room, const QStringList &members, const QString &msg ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceConfMsg); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + for( QStringList::const_iterator it = members.begin(); it != members.end(); it++ ) + t->setParam( 53, (*it).local8Bit() ); + t->setParam( 57, room.local8Bit() ); + t->setParam( 14, msg.utf8() ); + t->setParam( 97, 1 ); + + send( t ); +} +#include "conferencetask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/conferencetask.h b/kopete/protocols/yahoo/libkyahoo/conferencetask.h new file mode 100644 index 00000000..b6649a93 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/conferencetask.h @@ -0,0 +1,57 @@ +/* + Kopete Yahoo Protocol + Handles conferences + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 CONFERENCETASK_H +#define CONFERENCETASK_H + +#include "task.h" + +class YMSGTransfer; + +/** +@author André Duffeck +*/ +class ConferenceTask : public Task +{ + Q_OBJECT +public: + ConferenceTask(Task *parent); + ~ConferenceTask(); + + bool take(Transfer *transfer); + bool forMe( Transfer* transfer ) const; + + void joinConference( const QString &room, const QStringList &members ); + void declineConference( const QString &room, const QStringList &members, const QString &msg ); + void leaveConference( const QString &room, const QStringList &members ); + void sendMessage( const QString &room, const QStringList &members, const QString &msg ); + void inviteConference( const QString &room, const QStringList &members, const QString &msg ); + void addInvite( const QString &room, const QStringList &who, const QStringList &members, const QString &msg ); +signals: + void gotInvite( const QString &who, const QString &room, const QString &msg, const QStringList &members); + void gotMessage( const QString &who, const QString &room, const QString &msg ); + void userJoined( const QString &who, const QString &room ); + void userLeft( const QString &who, const QString &room ); + void userDeclined( const QString &who, const QString &room, const QString &msg ); +private: + void parseInvitation( YMSGTransfer *transfer ); + void parseMessage( YMSGTransfer *transfer ); + void parseUserJoined( YMSGTransfer *transfer ); + void parseUserLeft( YMSGTransfer *transfer ); + void parseUserDeclined( YMSGTransfer *transfer ); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/configure.in.in b/kopete/protocols/yahoo/libkyahoo/configure.in.in new file mode 100644 index 00000000..7b819074 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/configure.in.in @@ -0,0 +1,38 @@ +YAHOO2_VERSION="" +AC_SUBST(YAHOO2_VERSION) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_BIGENDIAN +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIZE_T +AC_STRUCT_TM + +AC_CHECK_TYPE([uint8_t],, +[AC_DEFINE([uint8_t], [unsigned char], +[Define to `unsigned char' if not defined.])]) +AC_CHECK_TYPE([uint32_t],, +[AC_DEFINE([uint32_t], [unsigned int], +[Define to `unsigned int' if not defined.])]) +AC_CHECK_TYPE([uint64_t],, +[AC_DEFINE([uint64_t], [unsigned long long], +[Define to `unsigned long long' if not defined.])]) + +dnl Checks for library functions. +AC_CHECK_FUNCS(strerror) + +# Checks for library functions. + +AC_ARG_WITH([struct-callbacks], [AC_HELP_STRING([--with-struct-callbacks], +[use a callback structure instead of callback functions])]) +if test "$with_struct_callbacks" = "yes"; then + AC_DEFINE(USE_STRUCT_CALLBACKS, 1, + [Define if you want to use a callback structure instead of callback functions]) +fi + +enable_sample_client="no" +AM_CONDITIONAL(SAMPLE_CLIENT, test "$enable_sample_client" != "no") + +YAHOOPKGREQ="" +AC_SUBST(YAHOOPKGREQ) + diff --git a/kopete/protocols/yahoo/libkyahoo/connector.cpp b/kopete/protocols/yahoo/libkyahoo/connector.cpp new file mode 100644 index 00000000..6ae174e8 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/connector.cpp @@ -0,0 +1,62 @@ +/* + Kopete Oscar Protocol + connector.cpp - the Oscar socket connector + + Copyright (c) 2004 Matt Rogers <[email protected]> + + Based on Iris, Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "connector.h" + +Connector::Connector(QObject *parent) +:QObject(parent) +{ + setPeerAddressNone(); +} + +Connector::~Connector() +{ +} + +bool Connector::havePeerAddress() const +{ + return haveaddr; +} + +QHostAddress Connector::peerAddress() const +{ + return addr; +} + +Q_UINT16 Connector::peerPort() const +{ + return port; +} + +void Connector::setPeerAddressNone() +{ + haveaddr = false; + addr = QHostAddress(); + port = 0; +} + +void Connector::setPeerAddress(const QHostAddress &_addr, Q_UINT16 _port) +{ + haveaddr = true; + addr = _addr; + port = _port; +} + +#include "connector.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/connector.h b/kopete/protocols/yahoo/libkyahoo/connector.h new file mode 100644 index 00000000..70e01f3d --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/connector.h @@ -0,0 +1,59 @@ +/* + Kopete Oscar Protocol + connector.h - the Oscar socket connector + + Copyright (c) 2004 Matt Rogers <[email protected]> + Based on code Copyright (c) 2004 SuSE Linux AG <http://www.suse.com> + Based on Iris, Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 LIBKYAHOO_CONNECTOR_H +#define LIBKYAHOO_CONNECTOR_H + + +#include <qobject.h> +#include "qhostaddress.h" + +class ByteStream; + +class Connector : public QObject +{ + Q_OBJECT +public: + Connector(QObject *parent=0); + virtual ~Connector(); + + virtual void connectToServer(const QString &server)=0; + virtual ByteStream *stream() const=0; + virtual void done()=0; + + bool havePeerAddress() const; + QHostAddress peerAddress() const; + Q_UINT16 peerPort() const; + +signals: + void connected(); + void error(); + +protected: + void setPeerAddressNone(); + void setPeerAddress(const QHostAddress &addr, Q_UINT16 port); + +private: + bool haveaddr; + QHostAddress addr; + Q_UINT16 port; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/coreprotocol.cpp b/kopete/protocols/yahoo/libkyahoo/coreprotocol.cpp new file mode 100644 index 00000000..b05cb16d --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/coreprotocol.cpp @@ -0,0 +1,228 @@ +/* + Kopete Yahoo Protocol + + Copyright (c) 2004 Duncan Mac-Vicar P. <[email protected]> + + Based on code + Copyright (c) 2004 SuSE Linux AG <http://www.suse.com> + Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include <string.h> +#include <iostream> + +#include <qdatastream.h> +#include <qdatetime.h> +#include <qtextstream.h> + + +#include <kdebug.h> +#include <kurl.h> + +#include "coreprotocol.h" +#include "ymsgprotocol.h" +#include "ymsgtransfer.h" + +CoreProtocol::CoreProtocol() : QObject() +{ + m_YMSGProtocol = new YMSGProtocol( this, "ymsgprotocol" ); +} + +CoreProtocol::~CoreProtocol() +{ +} + +int CoreProtocol::state() +{ + return m_state; +} + +void CoreProtocol::addIncomingData( const QByteArray & incomingBytes ) +{ + // store locally + int oldsize = m_in.size(); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << incomingBytes.size() << " bytes. already had " << oldsize << " bytes" << endl; + + m_in.resize( oldsize + incomingBytes.size() ); + memcpy( m_in.data() + oldsize, incomingBytes.data(), incomingBytes.size() ); + + m_state = Available; + // convert every event in the chunk to a Transfer, signalling it back to the clientstream + + int parsedBytes = 0; + int transferCount = 0; + // while there is data left in the input buffer, and we are able to parse something out of it + + while ( m_in.size() && ( parsedBytes = wireToTransfer(m_in) ) ) + { + transferCount++; + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " parsed transfer " << transferCount << " in chunk of "<< parsedBytes << " bytes" << endl; + int size = m_in.size(); + if ( parsedBytes < size ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " more data in chunk! ( I have parsed " << parsedBytes << " and total data of " << size << ")" << endl; + // copy the unparsed bytes into a new qbytearray and replace m_in with that + QByteArray remainder( size - parsedBytes ); + memcpy( remainder.data(), m_in.data() + parsedBytes, remainder.size() ); + m_in = remainder; + } + else + m_in.truncate( 0 ); + } + if ( m_state == NeedMore ) + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " message was incomplete, waiting for more..." << endl; + /* + if ( m_eventProtocol->state() == EventProtocol::OutOfSync ) + { + qDebug( " - protocol thinks it's out of sync, discarding the rest of the buffer and hoping the server regains sync soon..." ); + m_in.truncate( 0 ); + } + */ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " done processing chunk" << endl; + +} + +Transfer* CoreProtocol::incomingTransfer() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + if ( m_state == Available ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " - got a transfer" << endl; + m_state = NoData; + return m_inTransfer; + m_inTransfer = 0; + } + else + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " no milk today" << endl; + return 0; + } +} + +void cp_dump( const QByteArray &bytes ) +{ +#ifdef YAHOO_COREPROTOCOL_DEBUG + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " contains " << bytes.count() << " bytes" << endl; + for ( uint i = 0; i < bytes.count(); ++i ) + { + printf( "%02x ", bytes[ i ] ); + } + printf( "\n" ); +#else + Q_UNUSED( bytes ); +#endif +} + +void CoreProtocol::outgoingTransfer( Transfer* outgoing ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + if ( outgoing->type() == Transfer::YMSGTransfer ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " got YMSGTransfer" << endl; + YMSGTransfer *yt = (YMSGTransfer *) outgoing; + QByteArray bytesOut = yt->serialize(); + + //QTextStream dout( bytesOut, IO_WriteOnly ); + //dout.setEncoding( QTextStream::Latin1 ); + //dout.setByteOrder( QDataStream::LittleEndian ); + //dout << bytesOut; + //kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " " << bytesOut << endl; + emit outgoingData( bytesOut ); + // now convert + //fieldsToWire( fields ); + } + delete outgoing; +} + + + +int CoreProtocol::wireToTransfer( const QByteArray& wire ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + // processing incoming data and reassembling it into transfers + // may be an event or a response + + uint bytesParsed = 0; + + if ( wire.size() < 20 ) // minimal value of a YMSG header + { + m_state = NeedMore; + return bytesParsed; + } + + QDataStream din( wire, IO_ReadOnly ); + + // look at first four bytes and decide what to do with the chunk + if ( okToProceed( din ) ) + { + if ( (wire[0] == 'Y') && (wire[1] == 'M') && (wire[2] == 'S') && (wire[3] == 'G')) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " - looks like a valid YMSG packet" << endl; + Transfer *t = m_YMSGProtocol->parse( wire, bytesParsed ); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " - YMSG Protocol parsed " << bytesParsed << " bytes" << endl; + if ( t ) + { + m_inTransfer = t; + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " - got a valid packet " << endl; + + m_state = Available; + emit incomingData(); + } + else + bytesParsed = 0; + } + else + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " - not a valid YMSG packet. Trying to recover: " << wire << endl; + QTextStream s( wire, IO_ReadOnly ); + QString remaining = s.read(); + int pos = remaining.find( "YMSG", bytesParsed ); + if( pos >= 0 ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Recover successful." << endl; + bytesParsed += pos; + } + else + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Recover failed. Dump it!" << endl; + bytesParsed = wire.size(); + } + } + } + return bytesParsed; +} + +void CoreProtocol::reset() +{ + m_in.resize( 0 ); +} + +void CoreProtocol::slotOutgoingData( const QCString &out ) +{ + qDebug( "%s", out.data() ); +} + +bool CoreProtocol::okToProceed( QDataStream &din) +{ + if ( din.atEnd() ) + { + m_state = NeedMore; + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " saved message prematurely" << endl; + return false; + } + else + return true; +} + +#include "coreprotocol.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/coreprotocol.h b/kopete/protocols/yahoo/libkyahoo/coreprotocol.h new file mode 100644 index 00000000..fb78aa39 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/coreprotocol.h @@ -0,0 +1,107 @@ +/* + Kopete Yahoo Protocol + + Copyright (c) 2004 Duncan Mac-Vicar P. <[email protected]> + + Based on code + Copyright (c) 2004 SuSE Linux AG <http://www.suse.com> + Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 YAHOO_CORE_PROTOCOL_H +#define YAHOO_CORE_PROTOCOL_H + +#include <qcstring.h> +#include <qobject.h> +#include <qptrlist.h> + +class Transfer; +class YMSGProtocol; + +class CoreProtocol : public QObject +{ +Q_OBJECT +public: + enum State { NeedMore, Available, NoData, OutOfSync }; + + CoreProtocol(); + + virtual ~CoreProtocol(); + + /** + * Reset the protocol, clear buffers + */ + void reset(); + + /** + * Accept data from the network, and buffer it into a useful message + * This requires parsing out each FLAP, etc. from the incoming data + * @param incomingBytes Raw data in wire format. + */ + void addIncomingData( const QByteArray& incomingBytes ); + + /** + * @return the incoming transfer or 0 if none is available. + */ + Transfer* incomingTransfer(); + + /** + * Convert a request into an outgoing transfer + * emits @ref outgoingData() with each part of the transfer + */ + void outgoingTransfer( Transfer* outgoing ); + + /** + * Get the state of the protocol + */ + int state(); + +signals: + /** + * Emitted as the core protocol converts fields to wire ready data + */ + void outgoingData( const QByteArray& ); + + /** + * Emitted when there is incoming data, parsed into a Transfer + */ + void incomingData(); +protected slots: + /** + * Just a debug method to test emitting to the socket, atm - should go to the ClientStream + */ + void slotOutgoingData( const QCString & ); + +protected: + /** + * Check that there is data to read, and set the protocol's state if there isn't any. + */ + bool okToProceed( QDataStream & ); + /** + * Convert incoming wire data into a Transfer object and queue it + * @return number of bytes from the input that were parsed into a Transfer + */ + int wireToTransfer( const QByteArray& wire ); + +private: + QByteArray m_in; // buffer containing unprocessed bytes we received + int m_error; + Transfer* m_inTransfer; // the transfer that is being received + int m_state; // represents the protocol's overall state + YMSGProtocol* m_YMSGProtocol; + +}; + +#endif + diff --git a/kopete/protocols/yahoo/libkyahoo/crypt.c b/kopete/protocols/yahoo/libkyahoo/crypt.c new file mode 100644 index 00000000..3aabeced --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/crypt.c @@ -0,0 +1,210 @@ +/* One way encryption based on MD5 sum. + Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <[email protected]>, 1996. + + The GNU C 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.1 of the License, or (at your option) any later version. + + The GNU C 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* warmenhoven took this file and made it work with the md5.[ch] we + * already had. isn't that lovely. people should just use linux or + * freebsd, crypt works properly on those systems. i hate solaris */ + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#if HAVE_STRING_H +# include <string.h> +#elif HAVE_STRINGS_H +# include <strings.h> +#endif + +#include <stdlib.h> + +#include "md5.h" +/* for MIN and MAX */ +#include "libyahoo.h" + +/* Define our magic string to mark salt for MD5 "encryption" + replacement. This is meant to be the same as for other MD5 based + encryption implementations. */ +static const char md5_salt_prefix[] = "$1$"; + +/* Table with characters for base64 transformation. */ +static const char b64t[64] = +"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + +char *yahoo_crypt(const char *key, const char *salt); + +char *yahoo_crypt(const char *key, const char *salt) +{ + char *buffer = NULL; + int buflen = 0; + int needed = 3 + strlen (salt) + 1 + 26 + 1; + + md5_byte_t alt_result[16]; + md5_state_t ctx; + md5_state_t alt_ctx; + size_t salt_len; + size_t key_len; + size_t cnt; + char *cp; + + if (buflen < needed) { + buflen = needed; + if ((buffer = realloc(buffer, buflen)) == NULL) + return NULL; + } + + /* Find beginning of salt string. The prefix should normally always + be present. Just in case it is not. */ + if (strncmp (md5_salt_prefix, salt, sizeof (md5_salt_prefix) - 1) == 0) + /* Skip salt prefix. */ + salt += sizeof (md5_salt_prefix) - 1; + + salt_len = MIN (strcspn (salt, "$"), 8); + key_len = strlen (key); + + /* Prepare for the real work. */ + md5_init(&ctx); + + /* Add the key string. */ + md5_append(&ctx, (md5_byte_t *)key, key_len); + + /* Because the SALT argument need not always have the salt prefix we + add it separately. */ + md5_append(&ctx, (md5_byte_t *)md5_salt_prefix, sizeof (md5_salt_prefix) - 1); + + /* The last part is the salt string. This must be at most 8 + characters and it ends at the first `$' character (for + compatibility which existing solutions). */ + md5_append(&ctx, (md5_byte_t *)salt, salt_len); + + /* Compute alternate MD5 sum with input KEY, SALT, and KEY. The + final result will be added to the first context. */ + md5_init(&alt_ctx); + + /* Add key. */ + md5_append(&alt_ctx, (md5_byte_t *)key, key_len); + + /* Add salt. */ + md5_append(&alt_ctx, (md5_byte_t *)salt, salt_len); + + /* Add key again. */ + md5_append(&alt_ctx, (md5_byte_t *)key, key_len); + + /* Now get result of this (16 bytes) and add it to the other + context. */ + md5_finish(&alt_ctx, alt_result); + + /* Add for any character in the key one byte of the alternate sum. */ + for (cnt = key_len; cnt > 16; cnt -= 16) + md5_append(&ctx, alt_result, 16); + md5_append(&ctx, alt_result, cnt); + + /* For the following code we need a NUL byte. */ + alt_result[0] = '\0'; + + /* The original implementation now does something weird: for every 1 + bit in the key the first 0 is added to the buffer, for every 0 + bit the first character of the key. This does not seem to be + what was intended but we have to follow this to be compatible. */ + for (cnt = key_len; cnt > 0; cnt >>= 1) + md5_append(&ctx, (cnt & 1) != 0 ? alt_result : (md5_byte_t *)key, 1); + + /* Create intermediate result. */ + md5_finish(&ctx, alt_result); + + /* Now comes another weirdness. In fear of password crackers here + comes a quite long loop which just processes the output of the + previous round again. We cannot ignore this here. */ + for (cnt = 0; cnt < 1000; ++cnt) { + /* New context. */ + md5_init(&ctx); + + /* Add key or last result. */ + if ((cnt & 1) != 0) + md5_append(&ctx, (md5_byte_t *)key, key_len); + else + md5_append(&ctx, alt_result, 16); + + /* Add salt for numbers not divisible by 3. */ + if (cnt % 3 != 0) + md5_append(&ctx, (md5_byte_t *)salt, salt_len); + + /* Add key for numbers not divisible by 7. */ + if (cnt % 7 != 0) + md5_append(&ctx, (md5_byte_t *)key, key_len); + + /* Add key or last result. */ + if ((cnt & 1) != 0) + md5_append(&ctx, alt_result, 16); + else + md5_append(&ctx, (md5_byte_t *)key, key_len); + + /* Create intermediate result. */ + md5_finish(&ctx, alt_result); + } + + /* Now we can construct the result string. It consists of three + parts. */ + + strncpy(buffer, md5_salt_prefix, MAX (0, buflen)); + cp = buffer + strlen(buffer); + buflen -= sizeof (md5_salt_prefix); + + strncpy(cp, salt, MIN ((size_t) buflen, salt_len)); + cp = cp + strlen(cp); + buflen -= MIN ((size_t) buflen, salt_len); + + if (buflen > 0) { + *cp++ = '$'; + --buflen; + } + +#define b64_from_24bit(B2, B1, B0, N) \ + do { \ + unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \ + int n = (N); \ + while (n-- > 0 && buflen > 0) { \ + *cp++ = b64t[w & 0x3f]; \ + --buflen; \ + w >>= 6; \ + }\ + } while (0) + + b64_from_24bit (alt_result[0], alt_result[6], alt_result[12], 4); + b64_from_24bit (alt_result[1], alt_result[7], alt_result[13], 4); + b64_from_24bit (alt_result[2], alt_result[8], alt_result[14], 4); + b64_from_24bit (alt_result[3], alt_result[9], alt_result[15], 4); + b64_from_24bit (alt_result[4], alt_result[10], alt_result[5], 4); + b64_from_24bit (0, 0, alt_result[11], 2); + if (buflen <= 0) { + FREE(buffer); + } else + *cp = '\0'; /* Terminate the string. */ + + /* Clear the buffer for the intermediate result so that people + attaching to processes or reading core dumps cannot get any + information. We do it in this way to clear correct_words[] + inside the MD5 implementation as well. */ + md5_init(&ctx); + md5_finish(&ctx, alt_result); + memset (&ctx, '\0', sizeof (ctx)); + memset (&alt_ctx, '\0', sizeof (alt_ctx)); + + return buffer; +} diff --git a/kopete/protocols/yahoo/libkyahoo/filetransfernotifiertask.cpp b/kopete/protocols/yahoo/libkyahoo/filetransfernotifiertask.cpp new file mode 100644 index 00000000..7d2042e4 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/filetransfernotifiertask.cpp @@ -0,0 +1,152 @@ +/* + Kopete Yahoo Protocol + Notifies about incoming filetransfers + + Copyright (c) 2006 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "filetransfernotifiertask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> + +FileTransferNotifierTask::FileTransferNotifierTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +FileTransferNotifierTask::~FileTransferNotifierTask() +{ + +} + +bool FileTransferNotifierTask::take( Transfer* transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if ( !forMe( transfer ) ) + return false; + + YMSGTransfer *t = static_cast<YMSGTransfer*>(transfer); + + if( t->service() == Yahoo::ServiceFileTransfer ) + parseFileTransfer( t ); + else if( t->service() == Yahoo::ServiceFileTransfer7 ) + parseFileTransfer7( t ); + else if( t->service() == Yahoo::ServicePeerToPeer ) + acceptFileTransfer( t ); + + + return true; +} + +bool FileTransferNotifierTask::forMe( Transfer *transfer ) const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + + if( t->service() == Yahoo::ServiceP2PFileXfer || + t->service() == Yahoo::ServicePeerToPeer || + t->service() == Yahoo::ServiceFileTransfer || + t->service() == Yahoo::ServiceFileTransfer7 + ) + return true; + else + return false; +} + +void FileTransferNotifierTask::parseFileTransfer( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString from; /* key = 4 */ + QString to; /* key = 5 */ + QString url; /* key = 20 */ + long expires; /* key = 38 */ + QString msg; /* key = 14 */ + QString filename; /* key = 27 */ + unsigned long size; /* key = 28 */ + + from = t->firstParam( 4 ); + to = t->firstParam( 5 ); + url = t->firstParam( 20 ); + expires = t->firstParam( 38 ).toLong(); + msg = t->firstParam( 14 ); + filename = t->firstParam( 27 ); + size = t->firstParam( 28 ).toULong(); + + + + if( from.startsWith( "FILE_TRANSFER_SYSTEM" ) ) + { + client()->notifyError( "Fileupload result received.", msg, Client::Notice ); + return; + } + + if( url.isEmpty() ) + return; + + + unsigned int left = url.findRev( '/' ) + 1; + unsigned int right = url.findRev( '?' ); + filename = url.mid( left, right - left ); + + emit incomingFileTransfer( from, url, expires, msg, filename, size ); +} + +void FileTransferNotifierTask::parseFileTransfer7( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString from; /* key = 4 */ + QString to; /* key = 5 */ + QString url; /* key = 20 */ + long expires; /* key = 38 */ + QString msg; /* key = 14 */ + QString filename; /* key = 27 */ + unsigned long size; /* key = 28 */ + + if( t->firstParam( 222 ).toInt() == 2 ) + return; // user cancelled the file transfer + + from = t->firstParam( 4 ); + to = t->firstParam( 5 ); + url = t->firstParam( 265 ); + expires = t->firstParam( 38 ).toLong(); + msg = t->firstParam( 14 ); + filename = t->firstParam( 27 ); + size = t->firstParam( 28 ).toULong(); + + emit incomingFileTransfer( from, url, expires, msg, filename, size ); +} + +void FileTransferNotifierTask::acceptFileTransfer( YMSGTransfer *transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServicePeerToPeer); + t->setId( client()->sessionID() ); + t->setParam( 4, client()->userId().local8Bit() ); + t->setParam( 5, transfer->firstParam( 4 ) ); + t->setParam( 11, transfer->firstParam( 11 ) ); + + send( t ); +} + +#include "filetransfernotifiertask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/filetransfernotifiertask.h b/kopete/protocols/yahoo/libkyahoo/filetransfernotifiertask.h new file mode 100644 index 00000000..0fd01eec --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/filetransfernotifiertask.h @@ -0,0 +1,50 @@ +/* + Kopete Yahoo Protocol + Notifies about incoming filetransfers + + Copyright (c) 2006 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 FILETRANSFERNOTIFIERTASK_H +#define FILETRANSFERNOTIFIERTASK_H + +#include "task.h" +#include "yahootypes.h" + +class QString; +class YMSGTransfer; + +/** +@author André Duffeck +*/ +class FileTransferNotifierTask : public Task +{ +Q_OBJECT +public: + FileTransferNotifierTask(Task *parent); + ~FileTransferNotifierTask(); + + bool take(Transfer *transfer); + +protected: + bool forMe( Transfer *transfer ) const; +signals: + void incomingFileTransfer( const QString &who, const QString &url, long expires, const QString &msg , + const QString &fname, unsigned long size ); +private: + void parseFileTransfer( YMSGTransfer *transfer ); + void parseFileTransfer7( YMSGTransfer *transfer ); + void acceptFileTransfer( YMSGTransfer *t ); + void parseFileTransfer7Info( YMSGTransfer *YMSGtransfer ); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/inputprotocolbase.cpp b/kopete/protocols/yahoo/libkyahoo/inputprotocolbase.cpp new file mode 100644 index 00000000..5c2dfcc3 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/inputprotocolbase.cpp @@ -0,0 +1,98 @@ +/* + Kopete Groupwise Protocol + inputprotocolbase.cpp - Ancestor of all protocols used for reading GroupWise input + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "inputprotocolbase.h" + +InputProtocolBase::InputProtocolBase(QObject *parent, const char *name) + : QObject(parent, name) +{ +} + + +InputProtocolBase::~InputProtocolBase() +{ +} + +uint InputProtocolBase::state() const +{ + return m_state; +} + +bool InputProtocolBase::readString( QString &message ) +{ + uint len; + QCString rawData; + if ( !safeReadBytes( rawData, len ) ) + return false; + message = QString::fromUtf8( rawData.data(), len - 1 ); + return true; +} + + +bool InputProtocolBase::okToProceed() +{ + if ( m_din ) + { + if ( m_din->atEnd() ) + { + m_state = NeedMore; + qDebug( "InputProtocol::okToProceed() - Server message ended prematurely!" ); + } + else + return true; + } + return false; +} + +bool InputProtocolBase::safeReadBytes( QCString & data, uint & len ) +{ + // read the length of the bytes + Q_UINT32 val; + if ( !okToProceed() ) + return false; + *m_din >> val; + m_bytes += sizeof( Q_UINT32 ); + if ( val > 1024 ) + return false; + //qDebug( "EventProtocol::safeReadBytes() - expecting %i bytes", val ); + QCString temp( val ); + if ( val != 0 ) + { + if ( !okToProceed() ) + return false; + // if the server splits packets here we are in trouble, + // as there is no way to see how much data was actually read + m_din->readRawBytes( temp.data(), val ); + // the rest of the string will be filled with FF, + // so look for that in the last position instead of \0 + // this caused a crash - guessing that temp.length() is set to the number of bytes actually read... + // if ( (Q_UINT8)( * ( temp.data() + ( temp.length() - 1 ) ) ) == 0xFF ) + if ( temp.length() < ( val - 1 ) ) + { + qDebug( "InputProtocol::safeReadBytes() - string broke, giving up, only got: %i bytes out of %i", temp.length(), val ); + m_state = NeedMore; + return false; + } + } + data = temp; + len = val; + m_bytes += val; + return true; +} + +#include "inputprotocolbase.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/inputprotocolbase.h b/kopete/protocols/yahoo/libkyahoo/inputprotocolbase.h new file mode 100644 index 00000000..d65bd8f7 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/inputprotocolbase.h @@ -0,0 +1,72 @@ +/* + Kopete Groupwise Protocol + inputprotocolbase.h - Ancestor of all protocols used for reading GroupWise input + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 INPUTPROTOCOLBASE_H +#define INPUTPROTOCOLBASE_H + +#include <qobject.h> + +class Transfer; +/** +Defines a basic interface for protocols dealing with input from the GroupWise server. + +@author Kopete Developers +*/ +class InputProtocolBase : public QObject +{ +Q_OBJECT +public: + enum EventProtocolState { Success, NeedMore, OutOfSync, ProtocolError }; + InputProtocolBase(QObject *parent = 0, const char *name = 0); + ~InputProtocolBase(); + /** + * Returns a value describing the state of the object. + * If the object is given data to parse that does not begin with a recognised event code, + * it will become OutOfSync, to indicate that the input data probably contains leftover data not processed during a previous parse. + */ + uint state() const; + /** + * Attempt to parse the supplied data into a Transfer object + * @param bytes this will be set to the number of bytes that were successfully parsed. It is no indication of the success of the whole procedure + * @return On success, a Transfer object that the caller is responsible for deleting. It will be either an EventTransfer or a Response, delete as appropriate. On failure, returns 0. + */ + virtual Transfer * parse( const QByteArray &, uint & bytes ) = 0 ; +protected: + /** + * Reads an arbitrary string + * updates the bytes parsed counter + */ + bool readString( QString &message ); + /** + * Check that there is data to read, and set the protocol's state if there isn't any. + */ + bool okToProceed(); + /** + * read a Q_UINT32 giving the number of following bytes, then a string of that length + * updates the bytes parsed counter + * @return false if the string was broken or there was no data available at all + */ + bool safeReadBytes( QCString & data, uint & len ); + +protected: + uint m_state; + uint m_bytes; + QDataStream * m_din; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/libyahoo.c b/kopete/protocols/yahoo/libkyahoo/libyahoo.c new file mode 100644 index 00000000..93ba9956 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/libyahoo.c @@ -0,0 +1,532 @@ +/* + * libyahoo2: libyahoo2.c + * + * Some code copyright (C) 2002, Philip S Tellis <philip . tellis AT gmx . net> + * + * Much of this code was taken and adapted from the yahoo module for + * gaim released under the GNU GPL. This code is also released under the + * GNU GPL. + * + * This code is derivitive of Gaim <http://gaim.sourceforge.net> + * copyright (C) 1998-1999, Mark Spencer <[email protected]> + * 1998-1999, Adam Fritzler <[email protected]> + * 1998-2002, Rob Flynn <[email protected]> + * 2000-2002, Eric Warmenhoven <[email protected]> + * 2001-2002, Brian Macke <[email protected]> + * 2001, Anand Biligiri S <[email protected]> + * 2001, Valdis Kletnieks + * 2002, Sean Egan <[email protected]> + * 2002, Toby Gray <[email protected]> + * + * This library also uses code from other libraries, namely: + * Portions from libfaim copyright 1998, 1999 Adam Fritzler + * <[email protected]> + * Portions of Sylpheed copyright 2000-2002 Hiroyuki Yamamoto + * <[email protected]> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string.h> +#include <stdlib.h> +#include <ctype.h> +#include <stdio.h> + +#include "libyahoo.h" +#include "yahoo_fn.h" +#include "md5.h" +#include "sha1.h" + +extern char *yahoo_crypt(char *, char *); + +void yahooBase64(unsigned char *out, const unsigned char *in, int inlen) +/* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ +{ + char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789._"; + + for (; inlen >= 3; inlen -= 3) + { + *out++ = base64digits[in[0] >> 2]; + *out++ = base64digits[((in[0]<<4) & 0x30) | (in[1]>>4)]; + *out++ = base64digits[((in[1]<<2) & 0x3c) | (in[2]>>6)]; + *out++ = base64digits[in[2] & 0x3f]; + in += 3; + } + if (inlen > 0) + { + unsigned char fragment; + + *out++ = base64digits[in[0] >> 2]; + fragment = (in[0] << 4) & 0x30; + if (inlen > 1) + fragment |= in[1] >> 4; + *out++ = base64digits[fragment]; + *out++ = (inlen < 2) ? '-' + : base64digits[(in[1] << 2) & 0x3c]; + *out++ = '-'; + } + *out = '\0'; +} + +void authresp_0x0b(const char *seed, const char *sn, const char *password, char *resp_6, char *resp_96 ) +{ + md5_byte_t result[16]; + md5_state_t ctx; + + SHA1Context ctx1; + SHA1Context ctx2; + + const char *alphabet1 = "FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ"; + const char *alphabet2 = "F0E1D2C3B4A59687abcdefghijklmnop"; + + const char *challenge_lookup = "qzec2tb3um1olpar8whx4dfgijknsvy5"; + const char *operand_lookup = "+|&%/*^-"; + const char *delimit_lookup = ",;"; + + unsigned char *password_hash = malloc(25); + unsigned char *crypt_hash = malloc(25); + char *crypt_result = NULL; + unsigned char pass_hash_xor1[64]; + unsigned char pass_hash_xor2[64]; + unsigned char crypt_hash_xor1[64]; + unsigned char crypt_hash_xor2[64]; + char chal[7]; + + unsigned char digest1[20]; + unsigned char digest2[20]; + unsigned char magic_key_char[4]; + const unsigned char *magic_ptr; + + unsigned int magic[64]; + unsigned int magic_work = 0; + /*unsigned int value = 0;*/ + + char comparison_src[20]; + int x, i, j; + int depth = 0, table = 0; + int cnt = 0; + int magic_cnt = 0; + int magic_len; + /*int times = 0;*/ + + memset(pass_hash_xor1, 0, 64); + memset(pass_hash_xor2, 0, 64); + memset(crypt_hash_xor1, 0, 64); + memset(crypt_hash_xor2, 0, 64); + memset(digest1, 0, 20); + memset(digest2, 0, 20); + memset(magic, 0, 64); + memset(resp_6, 0, 100); + memset(resp_96, 0, 100); + memset(magic_key_char, 0, 4); + + /* + * Magic: Phase 1. Generate what seems to be a 30 + * byte value (could change if base64 + * ends up differently? I don't remember and I'm + * tired, so use a 64 byte buffer. + */ + + magic_ptr = (unsigned char *)seed; + + while (*magic_ptr != (int)NULL) { + char *loc; + + /* Ignore parentheses. */ + + if (*magic_ptr == '(' || *magic_ptr == ')') { + magic_ptr++; + continue; + } + + /* Characters and digits verify against + the challenge lookup. + */ + + if (isalpha(*magic_ptr) || isdigit(*magic_ptr)) { + loc = strchr(challenge_lookup, *magic_ptr); + if (!loc) { + /* This isn't good */ + continue; + } + + /* Get offset into lookup table and lsh 3. */ + + magic_work = loc - challenge_lookup; + magic_work <<= 3; + + magic_ptr++; + continue; + } else { + unsigned int local_store; + + loc = strchr(operand_lookup, *magic_ptr); + if (!loc) { + /* Also not good. */ + continue; + } + + local_store = loc - operand_lookup; + + /* Oops; how did this happen? */ + if (magic_cnt >= 64) + break; + + magic[magic_cnt++] = magic_work | local_store; + magic_ptr++; + continue; + } + } + + magic_len = magic_cnt; + magic_cnt = 0; + + /* Magic: Phase 2. Take generated magic value and + * sprinkle fairy dust on the values. */ + + for (magic_cnt = magic_len-2; magic_cnt >= 0; magic_cnt--) { + unsigned char byte1; + unsigned char byte2; + + /* Bad. Abort. + */ + if (magic_cnt >= magic_len) + break; + + byte1 = magic[magic_cnt]; + byte2 = magic[magic_cnt+1]; + + byte1 *= 0xcd; + byte1 ^= byte2; + + magic[magic_cnt+1] = byte1; + } + + /* Magic: Phase 3. This computes 20 bytes. The first 4 bytes are used as our magic + * key (and may be changed later); the next 16 bytes are an MD5 sum of the magic key + * plus 3 bytes. The 3 bytes are found by looping, and they represent the offsets + * into particular functions we'll later call to potentially alter the magic key. + * + * %-) + */ + + magic_cnt = 1; + x = 0; + + do { + unsigned int bl = 0; + unsigned int cl = magic[magic_cnt++]; + + if (magic_cnt >= magic_len) + break; + + if (cl > 0x7F) { + if (cl < 0xe0) + bl = cl = (cl & 0x1f) << 6; + else { + bl = magic[magic_cnt++]; + cl = (cl & 0x0f) << 6; + bl = ((bl & 0x3f) + cl) << 6; + } + + cl = magic[magic_cnt++]; + bl = (cl & 0x3f) + bl; + } else + bl = cl; + + comparison_src[x++] = (bl & 0xff00) >> 8; + comparison_src[x++] = bl & 0xff; + } while (x < 20); + + /* Dump magic key into a char for SHA1 action. */ + + + for(x = 0; x < 4; x++) + magic_key_char[x] = comparison_src[x]; + + /* Compute values for recursive function table! */ + memcpy( chal, magic_key_char, 4 ); + x = 1; + for( i = 0; i < 0xFFFF && x; i++ ) + { + for( j = 0; j < 5 && x; j++ ) + { + chal[4] = i; + chal[5] = i >> 8; + chal[6] = j; + md5_init( &ctx ); + md5_append( &ctx, chal, 7 ); + md5_finish( &ctx, result ); + if( memcmp( comparison_src + 4, result, 16 ) == 0 ) + { + depth = i; + table = j; + x = 0; + } + } + } + + /* Transform magic_key_char using transform table */ + x = magic_key_char[3] << 24 | magic_key_char[2] << 16 + | magic_key_char[1] << 8 | magic_key_char[0]; + x = yahoo_xfrm( table, depth, x ); + x = yahoo_xfrm( table, depth, x ); + magic_key_char[0] = x & 0xFF; + magic_key_char[1] = x >> 8 & 0xFF; + magic_key_char[2] = x >> 16 & 0xFF; + magic_key_char[3] = x >> 24 & 0xFF; + + /* Get password and crypt hashes as per usual. */ + md5_init(&ctx); + md5_append(&ctx, (md5_byte_t *)password, strlen(password)); + md5_finish(&ctx, result); + yahooBase64(password_hash, result, 16); + + md5_init(&ctx); + crypt_result = yahoo_crypt(password, "$1$_2S43d5f$"); + md5_append(&ctx, (md5_byte_t *)crypt_result, strlen(crypt_result)); + md5_finish(&ctx, result); + yahooBase64(crypt_hash, result, 16); + + /* Our first authentication response is based off + * of the password hash. */ + + for (x = 0; x < (int)strlen((char *)password_hash); x++) + pass_hash_xor1[cnt++] = password_hash[x] ^ 0x36; + + if (cnt < 64) + memset(&(pass_hash_xor1[cnt]), 0x36, 64-cnt); + + cnt = 0; + + for (x = 0; x < (int)strlen((char *)password_hash); x++) + pass_hash_xor2[cnt++] = password_hash[x] ^ 0x5c; + + if (cnt < 64) + memset(&(pass_hash_xor2[cnt]), 0x5c, 64-cnt); + + SHA1Init(&ctx1); + SHA1Init(&ctx2); + + /* The first context gets the password hash XORed + * with 0x36 plus a magic value + * which we previously extrapolated from our + * challenge. */ + + SHA1Update(&ctx1, pass_hash_xor1, 64); + if (j >= 3 ) + ctx1.totalLength = 0x1ff; + SHA1Update(&ctx1, magic_key_char, 4); + SHA1Final(&ctx1, digest1); + + /* The second context gets the password hash XORed + * with 0x5c plus the SHA-1 digest + * of the first context. */ + + SHA1Update(&ctx2, pass_hash_xor2, 64); + SHA1Update(&ctx2, digest1, 20); + SHA1Final(&ctx2, digest2); + + /* Now that we have digest2, use it to fetch + * characters from an alphabet to construct + * our first authentication response. */ + + for (x = 0; x < 20; x += 2) { + unsigned int val = 0; + unsigned int lookup = 0; + char byte[6]; + + memset(&byte, 0, 6); + + /* First two bytes of digest stuffed + * together. + */ + + val = digest2[x]; + val <<= 8; + val += digest2[x+1]; + + lookup = (val >> 0x0b); + lookup &= 0x1f; + if (lookup >= strlen(alphabet1)) + break; + sprintf(byte, "%c", alphabet1[lookup]); + strcat(resp_6, byte); + strcat(resp_6, "="); + + lookup = (val >> 0x06); + lookup &= 0x1f; + if (lookup >= strlen(alphabet2)) + break; + sprintf(byte, "%c", alphabet2[lookup]); + strcat(resp_6, byte); + + lookup = (val >> 0x01); + lookup &= 0x1f; + if (lookup >= strlen(alphabet2)) + break; + sprintf(byte, "%c", alphabet2[lookup]); + strcat(resp_6, byte); + + lookup = (val & 0x01); + if (lookup >= strlen(delimit_lookup)) + break; + sprintf(byte, "%c", delimit_lookup[lookup]); + strcat(resp_6, byte); + } + + /* Our second authentication response is based off + * of the crypto hash. */ + + cnt = 0; + memset(&digest1, 0, 20); + memset(&digest2, 0, 20); + + for (x = 0; x < (int)strlen((char *)crypt_hash); x++) + crypt_hash_xor1[cnt++] = crypt_hash[x] ^ 0x36; + + if (cnt < 64) + memset(&(crypt_hash_xor1[cnt]), 0x36, 64-cnt); + + cnt = 0; + + for (x = 0; x < (int)strlen((char *)crypt_hash); x++) + crypt_hash_xor2[cnt++] = crypt_hash[x] ^ 0x5c; + + if (cnt < 64) + memset(&(crypt_hash_xor2[cnt]), 0x5c, 64-cnt); + + SHA1Init(&ctx1); + SHA1Init(&ctx2); + + /* The first context gets the password hash XORed + * with 0x36 plus a magic value + * which we previously extrapolated from our + * challenge. */ + + SHA1Update(&ctx1, crypt_hash_xor1, 64); + if (j >= 3 ) + ctx1.totalLength = 0x1ff; + SHA1Update(&ctx1, magic_key_char, 4); + SHA1Final(&ctx1, digest1); + + /* The second context gets the password hash XORed + * with 0x5c plus the SHA-1 digest + * of the first context. */ + + SHA1Update(&ctx2, crypt_hash_xor2, 64); + SHA1Update(&ctx2, digest1, 20); + SHA1Final(&ctx2, digest2); + + /* Now that we have digest2, use it to fetch + * characters from an alphabet to construct + * our first authentication response. */ + + for (x = 0; x < 20; x += 2) { + unsigned int val = 0; + unsigned int lookup = 0; + + char byte[6]; + + memset(&byte, 0, 6); + + /* First two bytes of digest stuffed + * together. */ + + val = digest2[x]; + val <<= 8; + val += digest2[x+1]; + + lookup = (val >> 0x0b); + lookup &= 0x1f; + if (lookup >= strlen(alphabet1)) + break; + sprintf(byte, "%c", alphabet1[lookup]); + strcat(resp_96, byte); + strcat(resp_96, "="); + + lookup = (val >> 0x06); + lookup &= 0x1f; + if (lookup >= strlen(alphabet2)) + break; + sprintf(byte, "%c", alphabet2[lookup]); + strcat(resp_96, byte); + + lookup = (val >> 0x01); + lookup &= 0x1f; + if (lookup >= strlen(alphabet2)) + break; + sprintf(byte, "%c", alphabet2[lookup]); + strcat(resp_96, byte); + + lookup = (val & 0x01); + if (lookup >= strlen(delimit_lookup)) + break; + sprintf(byte, "%c", delimit_lookup[lookup]); + strcat(resp_96, byte); + } + + free(password_hash); + free(crypt_hash); +} + +char * getcookie(const char *rawcookie) +{ + char * cookie=NULL; + char * tmpcookie; + char * cookieend; + + if (strlen(rawcookie) < 2) + return NULL; + + tmpcookie = strdup(rawcookie+2); + cookieend = strchr(tmpcookie, ';'); + + if(cookieend) + *cookieend = '\0'; + + cookie = strdup(tmpcookie); + FREE(tmpcookie); + /* cookieend=NULL; not sure why this was there since the value is not preserved in the stack -dd */ + + return cookie; +} + +char * getlcookie(const char *cookie) +{ + char *tmp; + char *tmpend; + char *login_cookie = NULL; + + tmpend = strstr(cookie, "n="); + if(tmpend) { + tmp = strdup(tmpend+2); + tmpend = strchr(tmp, '&'); + if(tmpend) + *tmpend='\0'; + login_cookie = strdup(tmp); + FREE(tmp); + } + + return login_cookie; +} diff --git a/kopete/protocols/yahoo/libkyahoo/libyahoo.h b/kopete/protocols/yahoo/libkyahoo/libyahoo.h new file mode 100644 index 00000000..3a57482d --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/libyahoo.h @@ -0,0 +1,61 @@ +/* + * libyahoo2: libyahoo2.c + * + * Some code copyright (C) 2002, Philip S Tellis <philip . tellis AT gmx . net> + * + * Much of this code was taken and adapted from the yahoo module for + * gaim released under the GNU GPL. This code is also released under the + * GNU GPL. + * + * This code is derivitive of Gaim <http://gaim.sourceforge.net> + * copyright (C) 1998-1999, Mark Spencer <[email protected]> + * 1998-1999, Adam Fritzler <[email protected]> + * 1998-2002, Rob Flynn <[email protected]> + * 2000-2002, Eric Warmenhoven <[email protected]> + * 2001-2002, Brian Macke <[email protected]> + * 2001, Anand Biligiri S <[email protected]> + * 2001, Valdis Kletnieks + * 2002, Sean Egan <[email protected]> + * 2002, Toby Gray <[email protected]> + * + * This library also uses code from other libraries, namely: + * Portions from libfaim copyright 1998, 1999 Adam Fritzler + * <[email protected]> + * Portions of Sylpheed copyright 2000-2002 Hiroyuki Yamamoto + * <[email protected]> + * + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + +#ifndef LIB_YAHOO_UTILS_H +#define LIB_YAHOO_UTILS_H + +#ifndef MIN +#define MIN(x,y) ((x)<(y)?(x):(y)) +#endif + +#ifndef MAX +#define MAX(x,y) ((x)>(y)?(x):(y)) +#endif +#define FREE(x) if(x) {free(x); x=NULL;} + +void authresp_0x0b(const char *seed, const char *sn, const char *password, char *resp_6, char *resp_96 ); +void yahooBase64(unsigned char *out, const unsigned char *in, int inlen); +char * getlcookie(const char *cookie); +char * getcookie(const char *rawcookie); +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/listtask.cpp b/kopete/protocols/yahoo/libkyahoo/listtask.cpp new file mode 100644 index 00000000..261e7896 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/listtask.cpp @@ -0,0 +1,108 @@ +/* + Kopete Yahoo Protocol + Handles several lists such as buddylist, ignorelist and so on + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include <qstring.h> + +#include "listtask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "client.h" +#include <qstring.h> +#include <qstringlist.h> +#include <kdebug.h> + +ListTask::ListTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +ListTask::~ListTask() +{ + +} + +bool ListTask::take( Transfer* transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if ( !forMe( transfer ) ) + return false; + + YMSGTransfer *t = static_cast<YMSGTransfer *>(transfer); + + parseBuddyList( t ); + parseStealthList( t ); + + return true; +} + +bool ListTask::forMe( Transfer* transfer ) const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + + if ( t->service() == Yahoo::ServiceList ) + return true; + else + return false; +} + +void ListTask::parseBuddyList( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString raw; + m_list.append( t->firstParam( 87 ) ); + + if( t->firstParam( 59 ).isEmpty() ) + return; + + QStringList groups; + groups = QStringList::split( "\n", m_list ); + + for ( QStringList::Iterator groupIt = groups.begin(); groupIt != groups.end(); ++groupIt ) + { + QString group = (*groupIt).section(":", 0, 0); + QStringList buddies; + buddies = QStringList::split( ",", (*groupIt).section(":", 1,1) ); + for ( QStringList::Iterator buddyIt = buddies.begin(); buddyIt != buddies.end(); ++buddyIt ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Parsed buddy: " << *buddyIt << " in group " << group << endl; + emit gotBuddy( *buddyIt, QString::null, group ); + } + } + m_list.truncate( 0 ); +} + +void ListTask::parseStealthList( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString raw; + raw = t->firstParam( 185 ); + + QStringList buddies = QStringList::split( ",", raw ); + for ( QStringList::Iterator it = buddies.begin(); it != buddies.end(); ++it ) + { + emit stealthStatusChanged( *it, Yahoo::StealthActive ); + } +} + +#include "listtask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/listtask.h b/kopete/protocols/yahoo/libkyahoo/listtask.h new file mode 100644 index 00000000..09b98495 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/listtask.h @@ -0,0 +1,48 @@ +/* + Kopete Yahoo Protocol + Handles several lists such as buddylist, ignorelist and so on + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 LISTTASK_H +#define LISTTASK_H + +#include "task.h" +#include "yahootypes.h" + +class QString; +class YMSGTransfer; +/** +@author André Duffeck +*/ +class ListTask : public Task +{ +Q_OBJECT +public: + ListTask(Task *parent); + ~ListTask(); + + bool take(Transfer *transfer); + +protected: + bool forMe( Transfer *transfer ) const; + void parseBuddyList( YMSGTransfer *transfer ); + void parseStealthList( YMSGTransfer *transfer ); +signals: + void gotBuddy(const QString&, const QString&, const QString&); + void stealthStatusChanged( const QString&, Yahoo::StealthStatus ); +private: + QString m_list; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/logintask.cpp b/kopete/protocols/yahoo/libkyahoo/logintask.cpp new file mode 100644 index 00000000..72c598bc --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/logintask.cpp @@ -0,0 +1,303 @@ +/* + Kopete Yahoo Protocol + Handles logging into to the Yahoo service + + Copyright (c) 2004 Duncan Mac-Vicar P. <[email protected]> + + Copyright (c) 2005 André Duffeck <[email protected]> + + Kopete (c) 2002-2005 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include <qstring.h> + +#include "logintask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> +#include <stdlib.h> +extern "C" +{ +#include "libyahoo.h" +} + +LoginTask::LoginTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + mState = InitialState; +} + +LoginTask::~LoginTask() +{ + +} + +bool LoginTask::take(Transfer* transfer) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + /* + Yahoo login task has various stages + + 1 .- Initial State + 1.1 .- OnGo is called + 1.2 .- SendVerify() - send a service verify ack + 2.- SentVerify + 2.1 - take(), get a useless transfer, sendAuth is called + 3.- SentAuth + 2.2 - take(), get a transfer with login and challenge string + sendAuthResp is called. + 2.3 - Need to decode and send a transfer back + 4.- SentAuthResp + */ + + if ( !forMe( transfer ) ) + return false; + + YMSGTransfer *t = static_cast<YMSGTransfer *>(transfer); + + switch (mState) + { + case (InitialState): + client()->notifyError( "Error in login procedure.", "take called while in initial state", Client::Debug ); + return false; + break; + case (SentVerify): + sendAuth( t ); + return true; + break; + case (SentAuth): + sendAuthResp( t ); + return true; + break; + case (SentAuthResp): + parseCookies( t ); + handleAuthResp( t ); + // Throw transfer to the next task as it contains further data + return false; + break; + default: + return false; + break; + } +} + +bool LoginTask::forMe(Transfer* transfer) const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + switch (mState) + { + case (InitialState): + //there shouldn't be a incoming transfer for this task at this state + return false; + break; + case (SentVerify): + if ( t->service() == Yahoo::ServiceVerify ) + return true; + break; + case (SentAuth): + if ( t->service() == Yahoo::ServiceAuth ) + return true; + break; + case (SentAuthResp ): + if ( t->service() == Yahoo::ServiceList || + t->service() == Yahoo::ServiceAuthResp ) + return true; + default: + return false; + break; + } + return false; +} + +void LoginTask::onGo() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + /* initial state, we have to send a ServiceVerify */ + if (mState == InitialState) + sendVerify(); + else + client()->notifyError( "Error in login procedure.", "take called while not in initial state", Client::Debug ); +} + +void LoginTask::reset() +{ + mState = InitialState; +} + +void LoginTask::sendVerify() +{ + /* send a ServiceVerify */ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceVerify); + send( t ); + mState = SentVerify; +} + +void LoginTask::sendAuth(YMSGTransfer* transfer) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + // transfer is the verify ack transfer, no useful data in it. + Q_UNUSED(transfer); + + /* got ServiceVerify ACK, send a ServiceAuth with username */ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer *t = new YMSGTransfer( Yahoo::ServiceAuth ); + t->setParam( 1 , client()->userId().local8Bit() ); + send(t); + mState = SentAuth; +} + +void LoginTask::sendAuthResp(YMSGTransfer* t) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString sn = t->firstParam( 1 ); + QString seed = t->firstParam( 94 ); + QString version_s = t->firstParam( 13 ); + uint sessionID = t->id(); + int version = version_s.toInt(); + + switch (version) + { + case 0: + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Version pre 0x0b "<< version_s << endl; + break; + default: + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Version 0x0b "<< version_s << endl; + sendAuthResp_0x0b(sn, seed, sessionID); + break; + } + mState = SentAuthResp; + + emit haveSessionID( sessionID ); +} + +void LoginTask::sendAuthResp_0x0b(const QString &sn, const QString &seed, uint sessionID) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " with seed " << seed << endl; + char *resp_6 = (char *) malloc(100); + char *resp_96 = (char *) malloc(100); + authresp_0x0b(seed.latin1(), sn.latin1(), (client()->password()).latin1(), resp_6, resp_96); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "resp_6: " << resp_6 << " resp_69: " << resp_96 << endl; + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceAuthResp, m_stateOnConnect); + t->setId( sessionID ); + t->setParam( 0 , sn.local8Bit()); + t->setParam( 6 , resp_6); + t->setParam( 96 , resp_96); + t->setParam( 59 , "B\\tfckeert1kk1nl&b=2" ); // ??? + t->setParam( 135 , "7,0,0,437" ); // Client version + t->setParam( 148 , -60 ); + t->setParam( 244 , 524223 ); + t->setParam( 1 , sn.local8Bit()); + + if( !m_verificationWord.isEmpty() ) + { + t->setParam( 227 , m_verificationWord.local8Bit() ); + m_verificationWord = QString::null; + } + + free(resp_6); + free(resp_96); + send(t); + +} + +void LoginTask::sendAuthResp_pre_0x0b(const QString &/*sn*/, const QString &/*seed*/) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +void LoginTask::handleAuthResp(YMSGTransfer *t) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + switch( t->service() ) + { + case( Yahoo::ServiceList ): + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Emitting Signal" << endl; + emit loginResponse( Yahoo::LoginOk, QString::null ); + break; + case( Yahoo::ServiceAuthResp ): + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Emitting Signal" << endl; + emit loginResponse( t->firstParam( 66 ).toInt(), t->firstParam( 20 ) ); + break; + default: + break; + } + mState = InitialState; +} + +void LoginTask::setStateOnConnect( Yahoo::Status status ) +{ + m_stateOnConnect = status; +} + +void LoginTask::parseCookies( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + for( int i = 0; i < t->paramCount( 59 ); ++i) + { + QString cookie; + cookie = t->nthParam( 59, i ); + if( cookie.startsWith( "Y" ) ) + { + m_yCookie = getcookie( cookie.latin1() ); + m_loginCookie = getlcookie( cookie.latin1() ); + } + else if( cookie.startsWith( "T" ) ) + { + m_tCookie = getcookie( cookie.latin1() ); + } + else if( cookie.startsWith( "C" ) ) + { + m_cCookie = getcookie( cookie.latin1() ); + } + } + if( !m_yCookie.isEmpty() && !m_tCookie.isEmpty() && + !m_cCookie.isEmpty() ) + emit haveCookies(); +} + +void LoginTask::setVerificationWord( const QString &word ) +{ + m_verificationWord = word; +} + +const QString& LoginTask::yCookie() +{ + return m_yCookie; +} + +const QString& LoginTask::tCookie() +{ + return m_tCookie; +} + +const QString& LoginTask::cCookie() +{ + return m_cCookie; +} + +const QString& LoginTask::loginCookie() +{ + return m_loginCookie; +} +#include "logintask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/logintask.h b/kopete/protocols/yahoo/libkyahoo/logintask.h new file mode 100644 index 00000000..2ad68853 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/logintask.h @@ -0,0 +1,75 @@ +/* + Kopete Yahoo Protocol + Handles logging into to the Yahoo service + + Copyright (c) 2004 Duncan Mac-Vicar P. <[email protected]> + + Copyright (c) 2005 André Duffeck <[email protected]> + + Kopete (c) 2002-2005 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 LOGINTASK_H +#define LOGINTASK_H + +#include "task.h" +#include "yahootypes.h" + +class QString; +class YMSGTransfer; + +/** +@author Duncan Mac-Vicar +*/ +class LoginTask : public Task +{ +Q_OBJECT +public: + LoginTask(Task *parent); + ~LoginTask(); + + bool take(Transfer* transfer); + virtual void onGo(); + + void reset(); + void setStateOnConnect( Yahoo::Status status ); + void setVerificationWord( const QString &word ); + + const QString &yCookie(); + const QString &cCookie(); + const QString &tCookie(); + const QString &loginCookie(); +protected: + bool forMe( Transfer* transfer ) const; + enum State { InitialState, SentVerify, GotVerifyACK, SentAuth, GotAuthACK, SentAuthResp }; + void sendVerify(); + void sendAuth(YMSGTransfer* transfer); + void sendAuthResp(YMSGTransfer* transfer); + void sendAuthResp_0x0b(const QString &sn, const QString &seed, uint sessionID); + void sendAuthResp_pre_0x0b(const QString &sn, const QString &seed); + void handleAuthResp(YMSGTransfer *transfer); + void parseCookies( YMSGTransfer *transfer ); +signals: + void haveSessionID( uint ); + void haveCookies(); + void loginResponse( int, const QString& ); +private: + State mState; + Yahoo::Status m_stateOnConnect; + QString m_yCookie; + QString m_tCookie; + QString m_cCookie; + QString m_loginCookie; + QString m_verificationWord; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/logofftask.cpp b/kopete/protocols/yahoo/libkyahoo/logofftask.cpp new file mode 100644 index 00000000..ed79245e --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/logofftask.cpp @@ -0,0 +1,43 @@ +/* + Kopete Yahoo Protocol + Log off the Yahoo server + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "logofftask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> + +LogoffTask::LogoffTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +LogoffTask::~LogoffTask() +{ +} + +void LogoffTask::onGo() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceLogoff); + t->setId( client()->sessionID() ); + send( t ); + + setSuccess( true ); +} diff --git a/kopete/protocols/yahoo/libkyahoo/logofftask.h b/kopete/protocols/yahoo/libkyahoo/logofftask.h new file mode 100644 index 00000000..7ef6799d --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/logofftask.h @@ -0,0 +1,36 @@ +/* + Kopete Yahoo Protocol + Log off the Yahoo server + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 LOGOFFTASK_H +#define LOGOFFTASK_H + +#include "task.h" + +class QString; + +/** +@author André Duffeck +*/ +class LogoffTask : public Task +{ +public: + LogoffTask(Task *parent); + ~LogoffTask(); + + virtual void onGo(); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/mailnotifiertask.cpp b/kopete/protocols/yahoo/libkyahoo/mailnotifiertask.cpp new file mode 100644 index 00000000..7bea2c8f --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/mailnotifiertask.cpp @@ -0,0 +1,80 @@ +/* + Kopete Yahoo Protocol + Notifies about new mails + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include <qstring.h> + +#include "mailnotifiertask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> + +MailNotifierTask::MailNotifierTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +MailNotifierTask::~MailNotifierTask() +{ + +} + +bool MailNotifierTask::take( Transfer* transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if ( !forMe( transfer ) ) + return false; + + YMSGTransfer *t = static_cast<YMSGTransfer *>(transfer); + + parseMail( t ); + + return true; +} + +bool MailNotifierTask::forMe( Transfer* transfer ) const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + if ( t->service() == Yahoo::ServiceNewMail ) + return true; + else + return false; +} + +void MailNotifierTask::parseMail( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString count = t->firstParam( 9 ); + QString mail = t->firstParam( 42 ); + QString from = t->firstParam( 43 ); + QString subject = t->firstParam( 18 ); + + if( !mail.isEmpty() && !from.isEmpty() && !subject.isEmpty() ) + emit mailNotify( QString::fromLatin1( "%1 <%2>").arg( from, mail ), subject, count.toInt() ); + else + emit mailNotify( QString::null, QString::null, count.toInt()); +} + +#include "mailnotifiertask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/mailnotifiertask.h b/kopete/protocols/yahoo/libkyahoo/mailnotifiertask.h new file mode 100644 index 00000000..9fcf8ad4 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/mailnotifiertask.h @@ -0,0 +1,44 @@ +/* + Kopete Yahoo Protocol + Notifies about new mails + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 MAILNOTIFIERTASK_H +#define MAILNOTIFIERTASK_H + +#include "task.h" + +class QString; +class YMSGTransfer; + +/** +@author André Duffeck +*/ +class MailNotifierTask : public Task +{ +Q_OBJECT +public: + MailNotifierTask(Task *parent); + ~MailNotifierTask(); + + bool take(Transfer *transfer); + +protected: + bool forMe( Transfer *transfer ) const; + void parseMail( YMSGTransfer *transfer ); +signals: + void mailNotify(const QString&, const QString&, int); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/md5.c b/kopete/protocols/yahoo/libkyahoo/md5.c new file mode 100644 index 00000000..ede1fc11 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/md5.c @@ -0,0 +1,408 @@ +/* + Copyright (C) 1999 Aladdin Enterprises. All rights reserved. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + L. Peter Deutsch + + */ +/* + Independent implementation of MD5 (RFC 1321). + + This code implements the MD5 Algorithm defined in RFC 1321. + It is derived directly from the text of the RFC and not from the + reference implementation. + + The original and principal author of md5.c is L. Peter Deutsch + <[email protected]>. Other authors are noted in the change history + that follows (in reverse chronological order): + + 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. + 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). + 1999-05-03 lpd Original version. + */ + +#if HAVE_CONFIG_H +# include <config.h> +#endif + +#include "md5.h" + +#if STDC_HEADERS +# include <string.h> +#else +# if !HAVE_STRCHR +# define strchr index +# define strrchr rindex +# endif +char *strchr (), *strrchr (); +# if !HAVE_MEMCPY +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# define memmove(d, s, n) bcopy ((s), (d), (n)) +# endif +#endif + +#ifdef TEST +/* + * Compile with -DTEST to create a self-contained executable test program. + * The test program should print out the same values as given in section + * A.5 of RFC 1321, reproduced below. + */ +main() +{ + static const char *const test[7] = { + "", /*d41d8cd98f00b204e9800998ecf8427e*/ + "945399884.61923487334tuvga", /*0cc175b9c0f1b6a831c399e269772661*/ + "abc", /*900150983cd24fb0d6963f7d28e17f72*/ + "message digest", /*f96b697d7cb7938d525a2f31aaf161d0*/ + "abcdefghijklmnopqrstuvwxyz", /*c3fcd3d76192e4007dfb496cca67e13b*/ + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + /*d174ab98d277d9f5a5611c2c9f419d9f*/ + "12345678901234567890123456789012345678901234567890123456789012345678901234567890" /*57edf4a22be3c955ac49da2e2107b67a*/ + }; + int i; + + for (i = 0; i < 7; ++i) { + md5_state_t state; + md5_byte_t digest[16]; + int di; + + md5_init(&state); + md5_append(&state, (const md5_byte_t *)test[i], strlen(test[i])); + md5_finish(&state, digest); + printf("MD5 (\"%s\") = ", test[i]); + for (di = 0; di < 16; ++di) + printf("%02x", digest[di]); + printf("\n"); + } + return 0; +} +#endif /* TEST */ + + +/* + * For reference, here is the program that computed the T values. + */ +#if 0 +#include <math.h> +main() +{ + int i; + for (i = 1; i <= 64; ++i) { + unsigned long v = (unsigned long)(4294967296.0 * fabs(sin((double)i))); + printf("#define T%d 0x%08lx\n", i, v); + } + return 0; +} +#endif +/* + * End of T computation program. + */ +#define T1 0xd76aa478 +#define T2 0xe8c7b756 +#define T3 0x242070db +#define T4 0xc1bdceee +#define T5 0xf57c0faf +#define T6 0x4787c62a +#define T7 0xa8304613 +#define T8 0xfd469501 +#define T9 0x698098d8 +#define T10 0x8b44f7af +#define T11 0xffff5bb1 +#define T12 0x895cd7be +#define T13 0x6b901122 +#define T14 0xfd987193 +#define T15 0xa679438e +#define T16 0x49b40821 +#define T17 0xf61e2562 +#define T18 0xc040b340 +#define T19 0x265e5a51 +#define T20 0xe9b6c7aa +#define T21 0xd62f105d +#define T22 0x02441453 +#define T23 0xd8a1e681 +#define T24 0xe7d3fbc8 +#define T25 0x21e1cde6 +#define T26 0xc33707d6 +#define T27 0xf4d50d87 +#define T28 0x455a14ed +#define T29 0xa9e3e905 +#define T30 0xfcefa3f8 +#define T31 0x676f02d9 +#define T32 0x8d2a4c8a +#define T33 0xfffa3942 +#define T34 0x8771f681 +#define T35 0x6d9d6122 +#define T36 0xfde5380c +#define T37 0xa4beea44 +#define T38 0x4bdecfa9 +#define T39 0xf6bb4b60 +#define T40 0xbebfbc70 +#define T41 0x289b7ec6 +#define T42 0xeaa127fa +#define T43 0xd4ef3085 +#define T44 0x04881d05 +#define T45 0xd9d4d039 +#define T46 0xe6db99e5 +#define T47 0x1fa27cf8 +#define T48 0xc4ac5665 +#define T49 0xf4292244 +#define T50 0x432aff97 +#define T51 0xab9423a7 +#define T52 0xfc93a039 +#define T53 0x655b59c3 +#define T54 0x8f0ccc92 +#define T55 0xffeff47d +#define T56 0x85845dd1 +#define T57 0x6fa87e4f +#define T58 0xfe2ce6e0 +#define T59 0xa3014314 +#define T60 0x4e0811a1 +#define T61 0xf7537e82 +#define T62 0xbd3af235 +#define T63 0x2ad7d2bb +#define T64 0xeb86d391 + +static void +md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) +{ + md5_word_t + a = pms->abcd[0], b = pms->abcd[1], + c = pms->abcd[2], d = pms->abcd[3]; + md5_word_t t; + +#ifndef ARCH_IS_BIG_ENDIAN +# define ARCH_IS_BIG_ENDIAN 1 /* slower, default implementation */ +#endif +#if ARCH_IS_BIG_ENDIAN + + /* + * On big-endian machines, we must arrange the bytes in the right + * order. (This also works on machines of unknown byte order.) + */ + md5_word_t X[16]; + const md5_byte_t *xp = data; + int i; + + for (i = 0; i < 16; ++i, xp += 4) + X[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); + +#else /* !ARCH_IS_BIG_ENDIAN */ + + /* + * On little-endian machines, we can process properly aligned data + * without copying it. + */ + md5_word_t xbuf[16]; + const md5_word_t *X; + + if (!((data - (const md5_byte_t *)0) & 3)) { + /* data are properly aligned */ + X = (const md5_word_t *)data; + } else { + /* not aligned */ + memcpy(xbuf, data, 64); + X = xbuf; + } +#endif + +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) + + /* Round 1. */ + /* Let [abcd k s i] denote the operation + a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ +#define F(x, y, z) (((x) & (y)) | (~(x) & (z))) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + F(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 0, 7, T1); + SET(d, a, b, c, 1, 12, T2); + SET(c, d, a, b, 2, 17, T3); + SET(b, c, d, a, 3, 22, T4); + SET(a, b, c, d, 4, 7, T5); + SET(d, a, b, c, 5, 12, T6); + SET(c, d, a, b, 6, 17, T7); + SET(b, c, d, a, 7, 22, T8); + SET(a, b, c, d, 8, 7, T9); + SET(d, a, b, c, 9, 12, T10); + SET(c, d, a, b, 10, 17, T11); + SET(b, c, d, a, 11, 22, T12); + SET(a, b, c, d, 12, 7, T13); + SET(d, a, b, c, 13, 12, T14); + SET(c, d, a, b, 14, 17, T15); + SET(b, c, d, a, 15, 22, T16); +#undef SET + + /* Round 2. */ + /* Let [abcd k s i] denote the operation + a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ +#define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + G(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 1, 5, T17); + SET(d, a, b, c, 6, 9, T18); + SET(c, d, a, b, 11, 14, T19); + SET(b, c, d, a, 0, 20, T20); + SET(a, b, c, d, 5, 5, T21); + SET(d, a, b, c, 10, 9, T22); + SET(c, d, a, b, 15, 14, T23); + SET(b, c, d, a, 4, 20, T24); + SET(a, b, c, d, 9, 5, T25); + SET(d, a, b, c, 14, 9, T26); + SET(c, d, a, b, 3, 14, T27); + SET(b, c, d, a, 8, 20, T28); + SET(a, b, c, d, 13, 5, T29); + SET(d, a, b, c, 2, 9, T30); + SET(c, d, a, b, 7, 14, T31); + SET(b, c, d, a, 12, 20, T32); +#undef SET + + /* Round 3. */ + /* Let [abcd k s t] denote the operation + a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + H(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 5, 4, T33); + SET(d, a, b, c, 8, 11, T34); + SET(c, d, a, b, 11, 16, T35); + SET(b, c, d, a, 14, 23, T36); + SET(a, b, c, d, 1, 4, T37); + SET(d, a, b, c, 4, 11, T38); + SET(c, d, a, b, 7, 16, T39); + SET(b, c, d, a, 10, 23, T40); + SET(a, b, c, d, 13, 4, T41); + SET(d, a, b, c, 0, 11, T42); + SET(c, d, a, b, 3, 16, T43); + SET(b, c, d, a, 6, 23, T44); + SET(a, b, c, d, 9, 4, T45); + SET(d, a, b, c, 12, 11, T46); + SET(c, d, a, b, 15, 16, T47); + SET(b, c, d, a, 2, 23, T48); +#undef SET + + /* Round 4. */ + /* Let [abcd k s t] denote the operation + a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ +#define I(x, y, z) ((y) ^ ((x) | ~(z))) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + I(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 0, 6, T49); + SET(d, a, b, c, 7, 10, T50); + SET(c, d, a, b, 14, 15, T51); + SET(b, c, d, a, 5, 21, T52); + SET(a, b, c, d, 12, 6, T53); + SET(d, a, b, c, 3, 10, T54); + SET(c, d, a, b, 10, 15, T55); + SET(b, c, d, a, 1, 21, T56); + SET(a, b, c, d, 8, 6, T57); + SET(d, a, b, c, 15, 10, T58); + SET(c, d, a, b, 6, 15, T59); + SET(b, c, d, a, 13, 21, T60); + SET(a, b, c, d, 4, 6, T61); + SET(d, a, b, c, 11, 10, T62); + SET(c, d, a, b, 2, 15, T63); + SET(b, c, d, a, 9, 21, T64); +#undef SET + + /* Then perform the following additions. (That is increment each + of the four registers by the value it had before this block + was started.) */ + pms->abcd[0] += a; + pms->abcd[1] += b; + pms->abcd[2] += c; + pms->abcd[3] += d; +} + +void +md5_init(md5_state_t *pms) +{ + pms->count[0] = pms->count[1] = 0; + pms->abcd[0] = 0x67452301; + pms->abcd[1] = 0xefcdab89; + pms->abcd[2] = 0x98badcfe; + pms->abcd[3] = 0x10325476; +} + +void +md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) +{ + const md5_byte_t *p = data; + int left = nbytes; + int offset = (pms->count[0] >> 3) & 63; + md5_word_t nbits = (md5_word_t)(nbytes << 3); + + if (nbytes <= 0) + return; + + /* Update the message length. */ + pms->count[1] += nbytes >> 29; + pms->count[0] += nbits; + if (pms->count[0] < nbits) + pms->count[1]++; + + /* Process an initial partial block. */ + if (offset) { + int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); + + memcpy(pms->buf + offset, p, copy); + if (offset + copy < 64) + return; + p += copy; + left -= copy; + md5_process(pms, pms->buf); + } + + /* Process full blocks. */ + for (; left >= 64; p += 64, left -= 64) + md5_process(pms, p); + + /* Process a final partial block. */ + if (left) + memcpy(pms->buf, p, left); +} + +void +md5_finish(md5_state_t *pms, md5_byte_t digest[16]) +{ + static const md5_byte_t pad[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + md5_byte_t data[8]; + int i; + + /* Save the length before padding. */ + for (i = 0; i < 8; ++i) + data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); + /* Pad to 56 bytes mod 64. */ + md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); + /* Append the length. */ + md5_append(pms, data, 8); + for (i = 0; i < 16; ++i) + digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); +} diff --git a/kopete/protocols/yahoo/libkyahoo/md5.h b/kopete/protocols/yahoo/libkyahoo/md5.h new file mode 100644 index 00000000..501cdbe1 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/md5.h @@ -0,0 +1,93 @@ +/* + Copyright (C) 1999 Aladdin Enterprises. All rights reserved. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + L. Peter Deutsch + + */ +/* + Independent implementation of MD5 (RFC 1321). + + This code implements the MD5 Algorithm defined in RFC 1321. + It is derived directly from the text of the RFC and not from the + reference implementation. + + The original and principal author of md5.h is L. Peter Deutsch + <[email protected]>. Other authors are noted in the change history + that follows (in reverse chronological order): + + 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. + 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); + added conditionalization for C++ compilation from Martin + Purschke <[email protected]>. + 1999-05-03 lpd Original version. + */ + +#ifndef md5_INCLUDED +# define md5_INCLUDED + +/* + * This code has some adaptations for the Ghostscript environment, but it + * will compile and run correctly in any environment with 8-bit chars and + * 32-bit ints. Specifically, it assumes that if the following are + * defined, they have the same meaning as in Ghostscript: P1, P2, P3, + * ARCH_IS_BIG_ENDIAN. + */ + +typedef unsigned char md5_byte_t; /* 8-bit byte */ +typedef unsigned int md5_word_t; /* 32-bit word */ + +/* Define the state of the MD5 Algorithm. */ +typedef struct md5_state_s { + md5_word_t count[2]; /* message length in bits, lsw first */ + md5_word_t abcd[4]; /* digest buffer */ + md5_byte_t buf[64]; /* accumulate block */ +} md5_state_t; + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Initialize the algorithm. */ +#ifdef P1 +void md5_init(P1(md5_state_t *pms)); +#else +void md5_init(md5_state_t *pms); +#endif + +/* Append a string to the message. */ +#ifdef P3 +void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes)); +#else +void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); +#endif + +/* Finish the message and return the digest. */ +#ifdef P2 +void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16])); +#else +void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); +#endif + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +#endif /* md5_INCLUDED */ diff --git a/kopete/protocols/yahoo/libkyahoo/messagereceivertask.cpp b/kopete/protocols/yahoo/libkyahoo/messagereceivertask.cpp new file mode 100644 index 00000000..f814d244 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/messagereceivertask.cpp @@ -0,0 +1,148 @@ +/* + Kopete Yahoo Protocol + Receive Messages + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include <qstring.h> + +#include "messagereceivertask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> + +MessageReceiverTask::MessageReceiverTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +MessageReceiverTask::~MessageReceiverTask() +{ +} + +bool MessageReceiverTask::take( Transfer* transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if ( !forMe( transfer ) ) + return false; + + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + if( t->service() == Yahoo::ServiceNotify ) + parseNotify( t ); + else + parseMessage( t ); + + return true; +} + +bool MessageReceiverTask::forMe( Transfer* transfer ) const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + if ( t->service() == Yahoo::ServiceMessage || + t->service() == Yahoo::ServiceGameMsg || + t->service() == Yahoo::ServiceSysMessage || + t->service() == Yahoo::ServiceNotify ) + return true; + else + return false; +} + +void MessageReceiverTask::parseMessage( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + int cnt = t->paramCount( 5 ); + for( int i = 0; i < cnt; ++i ) + { + QString to = t->nthParam( 5, i ); + QString timestamp = t->nthParamSeparated( 15, i, 4 ); + QString utf8 = t->nthParamSeparated( 97, i, 4 ); + QString from = t->nthParamSeparated( 1, i, 4 ).isEmpty() ? t->nthParam( 4, i ) : t->nthParamSeparated( 1, i, 4 ); + QString msg = t->nthParamSeparated( 14, i, 4 ); + QString sysmsg = t->nthParamSeparated( 16, i, 4 ); + + // The arrangement of the key->value pairs is different when there is only one message in the packet. + // Separating by key "5" (sender) doesn't work in that case, because the "1" and "4" keys are sent before the "5" key + if( cnt == 1 ) + from = t->firstParam( 1 ).isEmpty() ? t->firstParam( 4 ) : t->firstParam( 1 ); + + if( !sysmsg.isEmpty() ) + { + client()->notifyError( "Server message received: ", sysmsg, Client::Error ); + continue; + } + + if( msg.isEmpty() ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Got a empty message. Dropped." << endl; + continue; + } + + if( utf8.startsWith( "1" ) ) + msg = QString::fromUtf8( msg.latin1() ); + + if( t->service() == Yahoo::ServiceSysMessage ) + emit systemMessage( sysmsg ); + else + { + if( msg.startsWith( "<ding>" ) ) + emit gotBuzz( from, timestamp.toLong() ); + else + emit gotIm( from, msg, timestamp.toLong(), 0); + } + } +} + +void MessageReceiverTask::parseNotify( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString from = t->firstParam( 4 ); + //QString to = t->firstParam( 5 ); + QString type = t->firstParam( 49 ); + QString stat = t->firstParam( 13 ); + QString ind = t->firstParam( 14 ); + + if( type.startsWith( "TYPING" ) ) + emit gotTypingNotify( from, stat.toInt() ); + else if( type.startsWith( "GAME" ) ) + ; + else if( type.startsWith( "WEBCAMINVITE" ) ) + { + if( ind.startsWith(" ") ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Got a WebcamInvitation." << endl; + emit gotWebcamInvite( from ); + } + else + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Got a WebcamRequest-Response: " << ind.toInt() << endl; + } + } +} + +#include "messagereceivertask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/messagereceivertask.h b/kopete/protocols/yahoo/libkyahoo/messagereceivertask.h new file mode 100644 index 00000000..b9682315 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/messagereceivertask.h @@ -0,0 +1,49 @@ +/* + Kopete Yahoo Protocol + Receive Messages + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 MESSAGERECEIVERTASK_H +#define MESSAGERECEIVERTASK_H + +#include "task.h" + +class QString; +class YMSGTransfer; + +/** +@author André Duffeck +*/ +class MessageReceiverTask : public Task +{ +Q_OBJECT +public: + MessageReceiverTask(Task *parent); + ~MessageReceiverTask(); + + bool take(Transfer *transfer); + +protected: + bool forMe( Transfer *transfer ) const; + void parseMessage( YMSGTransfer *transfer ); + void parseNotify( YMSGTransfer *transfer ); +signals: + void gotIm(const QString&, const QString&, long, int); + void gotBuzz( const QString &who, long tm ); + void systemMessage(const QString&); + void gotTypingNotify(const QString &, int); + void gotWebcamInvite(const QString &); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/modifybuddytask.cpp b/kopete/protocols/yahoo/libkyahoo/modifybuddytask.cpp new file mode 100644 index 00000000..afae97cf --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/modifybuddytask.cpp @@ -0,0 +1,116 @@ +/* + Kopete Yahoo Protocol + Add a buddy to the Contactlist + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "modifybuddytask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> + +ModifyBuddyTask::ModifyBuddyTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +ModifyBuddyTask::~ModifyBuddyTask() +{ +} + +void ModifyBuddyTask::onGo() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + switch( m_type ) + { + case AddBuddy: + addBuddy(); + break; + case RemoveBuddy: + removeBuddy(); + break; + case MoveBuddy: + moveBuddy(); + break; + } + + + + setSuccess( true ); +} + +void ModifyBuddyTask::addBuddy() +{ + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceAddBuddy); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + t->setParam( 7, m_target.local8Bit() ); + t->setParam( 14, m_message.utf8() ); + t->setParam( 65, m_group.local8Bit() ); + t->setParam( 97, 1 ); // UTF-8 + send( t ); +} + +void ModifyBuddyTask::removeBuddy() +{ + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceRemBuddy); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + t->setParam( 7, m_target.local8Bit() ); + t->setParam( 65, m_group.local8Bit() ); + send( t ); +} + +void ModifyBuddyTask::moveBuddy() +{ + YMSGTransfer *mov = new YMSGTransfer( Yahoo::ServiceBuddyChangeGroup ); + mov->setId( client()->sessionID() ); + mov->setParam( 1, client()->userId().local8Bit() ); + mov->setParam( 302, 240 ); + mov->setParam( 300, 240 ); + mov->setParam( 7, m_target.local8Bit() ); + mov->setParam( 224, m_oldGroup.local8Bit() ); + mov->setParam( 264, m_group.local8Bit() ); + mov->setParam( 301, 240 ); + mov->setParam( 303, 240 ); + send( mov ); +} + +void ModifyBuddyTask::setTarget( const QString &target ) +{ + m_target = target; +} + +void ModifyBuddyTask::setMessage( const QString &text ) +{ + m_message = text; +} + +void ModifyBuddyTask::setGroup( const QString &group ) +{ + m_group = group; +} + +void ModifyBuddyTask::setOldGroup( const QString &old ) +{ + m_oldGroup = old; +} + +void ModifyBuddyTask::setType( Type type ) +{ + m_type = type; +} diff --git a/kopete/protocols/yahoo/libkyahoo/modifybuddytask.h b/kopete/protocols/yahoo/libkyahoo/modifybuddytask.h new file mode 100644 index 00000000..7438a25f --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/modifybuddytask.h @@ -0,0 +1,53 @@ +/* + Kopete Yahoo Protocol + Add, remove or move a buddy to the Contactlist + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 MODIFYBUDDYTASK_H +#define MODIFYBUDDYTASK_H + +#include "task.h" + +class QString; + +/** +@author André Duffeck +*/ +class ModifyBuddyTask : public Task +{ +public: + enum Type { AddBuddy, RemoveBuddy, MoveBuddy }; + ModifyBuddyTask(Task *parent); + ~ModifyBuddyTask(); + + virtual void onGo(); + + void setType( Type type ); + void setMessage( const QString &text ); + void setTarget( const QString &target ); + void setGroup( const QString &group ); + void setOldGroup( const QString &group ); +private: + void addBuddy(); + void removeBuddy(); + void moveBuddy(); + + QString m_message; + QString m_target; + QString m_group; + QString m_oldGroup; + Type m_type; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/modifyyabtask.cpp b/kopete/protocols/yahoo/libkyahoo/modifyyabtask.cpp new file mode 100644 index 00000000..fe741726 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/modifyyabtask.cpp @@ -0,0 +1,205 @@ +/* + Kopete Yahoo Protocol + modifyyabtask.h - Handles the Yahoo Address Book + + Copyright (c) 2006 André Duffeck <[email protected]> + Kopete (c) 2002-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "modifyyabtask.h" +#include "yabtask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <qdatastream.h> +#include <qdom.h> +#include <klocale.h> +#include <kio/global.h> +#include <kio/job.h> +#include <kio/jobclasses.h> +#include <kbufferedsocket.h> + +using namespace KNetwork; +ModifyYABTask::ModifyYABTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + m_socket = 0; +} + +ModifyYABTask::~ModifyYABTask() +{ + delete m_socket; +} + +void ModifyYABTask::onGo() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + m_socket = new KBufferedSocket( "address.yahoo.com", QString::number(80) ); + connect( m_socket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( connectSucceeded() ) ); + connect( m_socket, SIGNAL( gotError(int) ), this, SLOT( connectFailed(int) ) ); + + m_socket->connect(); +} + +void ModifyYABTask::setAction( Action action ) +{ + m_action = action; +} + +void ModifyYABTask::setEntry( const YABEntry &entry ) +{ + QDomDocument doc(""); + QDomElement root = doc.createElement( "ab" ); + QDomProcessingInstruction instr = doc.createProcessingInstruction("xml","version=\"1.0\" encoding=\"UTF-8\" "); + doc.appendChild(instr); + root.setAttribute( "k", client()->userId() ); + root.setAttribute( "cc", "1" ); + doc.appendChild( root ); + + QDomElement contact = doc.createElement( "ct" ); + entry.fillQDomElement( contact ); + switch( m_action ) + { + case EditEntry: + contact.setAttribute( "e", "1" ); + break; + case AddEntry: + contact.setAttribute( "a", "1" ); + break; + case DeleteEntry: + contact.setAttribute( "d", "1" ); + break; + } + root.appendChild( contact ); + + entry.dump(); + m_postData = doc.toString(); +} + +void ModifyYABTask::connectFailed( int i) +{ + m_socket->close(); + client()->notifyError( i18n( "An error occured saving the Addressbook entry." ), + QString( "%1 - %2").arg(i).arg(static_cast<const KBufferedSocket*>( sender() )->errorString()), Client::Error ); +} + +void ModifyYABTask::connectSucceeded() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString header = QString::fromLatin1("POST /yab/us?v=XM&prog=ymsgr&.intl=us&sync=1&tags=short&noclear=1& HTTP/1.1\r\n" + "Cookie: Y=%1; T=%2; C=%3 ;B=fckeert1kk1nl&b=2\r\n" + "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" + "Host: address.yahoo.com\r\n" + "Content-length: %4\r\n" + "Cache-Control: no-cache\r\n\r\n") + .arg(client()->yCookie()).arg(client()->tCookie()) + .arg(client()->cCookie()).arg(m_postData.utf8().size()); + + QByteArray buffer; + QByteArray paket; + QDataStream stream( buffer, IO_WriteOnly ); + stream.writeRawBytes( header.local8Bit(), header.length() ); + stream.writeRawBytes( m_postData.utf8(), m_postData.utf8().size() ); + + if( m_socket->writeBlock( buffer, buffer.size() ) ) + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Upload Successful. Waiting for confirmation..." << endl; + else + { + client()->notifyError( i18n( "An error occured saving the Addressbook entry." ), m_socket->errorString(), Client::Error ); + setSuccess( false ); + return; + } + + connect( m_socket, SIGNAL( readyRead() ), this, SLOT( slotRead() ) ); +} + +void ModifyYABTask::slotRead() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + QByteArray ar( m_socket->bytesAvailable() ); + m_socket->readBlock ( ar.data (), ar.size () ); + QString buf( ar ); + m_data += buf.right( buf.length() - buf.find("<?xml") ); + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << m_data.find("</ab>") << endl; + if( m_data.find("</ab>") < 0 ) + return; // Need more data + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << m_data.find("</ab>") << endl; + + m_socket->close(); + QDomDocument doc; + QDomNodeList list; + QDomElement e; + uint it = 0; + + doc.setContent( m_data ); + + list = doc.elementsByTagName( "ab" ); // Get the Addressbook + for( it = 0; it < list.count(); it++ ) { + if( !list.item( it ).isElement() ) + continue; + e = list.item( it ).toElement(); + + if( !e.attribute( "lm" ).isEmpty() ) + emit gotRevision( e.attribute( "lm" ).toLong(), true ); + + if( !e.attribute( "rt" ).isEmpty() ) + emit gotRevision( e.attribute( "rt" ).toLong(), false ); + } + + list = doc.elementsByTagName( "ct" ); // Get records + for( it = 0; it < list.count(); it++ ) { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Parsing entry..." << endl; + if( !list.item( it ).isElement() ) + continue; + e = list.item( it ).toElement(); + + YABEntry *entry = new YABEntry; + entry->fromQDomElement( e ); + entry->source = YABEntry::SourceYAB; + + switch( m_action ) + { + case EditEntry: + if( !e.attribute( "es" ).isEmpty() && e.attribute( "es" ) != "0" ) // Check for edit errors + { + emit error( entry, i18n("The Yahoo Addressbook entry could not be saved:\n%1 - %2").arg( e.attribute("es") ).arg( e.attribute("ee") ) ); + continue; + } + break; + case AddEntry: + if( !e.attribute( "as" ).isEmpty() && e.attribute( "as" ) != "0" ) // Check for add errors + { + emit error( entry, i18n("The Yahoo Addressbook entry could not be created:\n%1 - %2").arg( e.attribute("as") ).arg( e.attribute("ae") ) ); + continue; + } + break; + case DeleteEntry: + if( !e.attribute( "ds" ).isEmpty() && e.attribute( "ds" ) != "0" ) // Check for delete errors + { + emit error( entry, i18n("The Yahoo Addressbook entry could not be deleted:\n%1 - %2").arg( e.attribute("ds") ).arg( e.attribute("de") ) ); + continue; + } + break; + } + + // No errors occured + emit gotEntry( entry ); + } + + + setSuccess( true ); +} +#include "modifyyabtask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/modifyyabtask.h b/kopete/protocols/yahoo/libkyahoo/modifyyabtask.h new file mode 100644 index 00000000..488ae741 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/modifyyabtask.h @@ -0,0 +1,64 @@ +/* + Kopete Yahoo Protocol + modifyyabtask.h - Saves a YAB entry + + Copyright (c) 2006 André Duffeck <[email protected]> + Kopete (c) 2002-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 MODIFYYABTASK_H +#define MODIFYYABTASK_H + +#include "task.h" +#include "yabentry.h" + +struct KURL; +namespace KIO { + class Job; + class TransferJob; +} +namespace KNetwork { + class KBufferedSocket; +} +class QDomElement; + +/** +@author André Duffeck +*/ +class ModifyYABTask : public Task +{ + Q_OBJECT +public: + enum Action { AddEntry, EditEntry, DeleteEntry }; + ModifyYABTask(Task *parent); + ~ModifyYABTask(); + + virtual void onGo(); + void setAction( Action action ); + void setEntry( const YABEntry & ); +signals: + void gotEntry( YABEntry * ); + void gotRevision( long rev, bool merged ); + void error( YABEntry *, const QString &); +private slots: + void connectSucceeded(); + void connectFailed( int ); + void slotRead(); +private: + KIO::TransferJob *m_transferJob; + KNetwork::KBufferedSocket *m_socket; + QString m_postData; + QString m_data; + Action m_action; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/oscartypes.h b/kopete/protocols/yahoo/libkyahoo/oscartypes.h new file mode 100644 index 00000000..944019e7 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/oscartypes.h @@ -0,0 +1,31 @@ +/* + Kopete Oscar Protocol + oscartypes.h - Oscar Type Definitions + + Copyright (c) 2004 Matt Rogers <[email protected]> + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 _YAHOOTYPES_H_ +#define _YAHOOTYPES_H_ + +#include <qglobal.h> + +namespace Yahoo +{ + typedef Q_UINT8 BYTE; + typedef Q_UINT16 WORD; + typedef Q_UINT32 DWORD; +} + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/picturenotifiertask.cpp b/kopete/protocols/yahoo/libkyahoo/picturenotifiertask.cpp new file mode 100644 index 00000000..6259f7e8 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/picturenotifiertask.cpp @@ -0,0 +1,157 @@ +/* + Kopete Yahoo Protocol + Notifies about buddy icons + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "picturenotifiertask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <qstringlist.h> +#include <kurl.h> +#include <kdebug.h> +#include <klocale.h> + +PictureNotifierTask::PictureNotifierTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +PictureNotifierTask::~PictureNotifierTask() +{ + +} + +bool PictureNotifierTask::take( Transfer* transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if ( !forMe( transfer ) ) + return false; + + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + switch( t->service() ) + { + case Yahoo::ServicePictureStatus: + parsePictureStatus( t ); + break; + case Yahoo::ServicePictureChecksum: + parsePictureChecksum( t ); + break; + case Yahoo::ServicePicture: + parsePicture( t ); + break; + case Yahoo::ServicePictureUpload: + parsePictureUploadResponse( t ); + break; + default: + break; + } + + return true; +} + +bool PictureNotifierTask::forMe( Transfer* transfer ) const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + + if ( t->service() == Yahoo::ServicePictureChecksum || + t->service() == Yahoo::ServicePicture || + t->service() == Yahoo::ServicePictureUpdate || + t->service() == Yahoo::ServicePictureUpload || + t->service() == Yahoo::ServicePictureStatus ) + return true; + else + return false; +} + +void PictureNotifierTask::parsePictureStatus( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString nick; /* key = 4 */ + int state; /* key = 213 */ + + nick = t->firstParam( 4 ); + state = t->firstParam( 213 ).toInt(); + + emit pictureStatusNotify( nick, state ); +} + +void PictureNotifierTask::parsePictureChecksum( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString nick; /* key = 4 */ + int checksum; /* key = 192 */ + + nick = t->firstParam( 4 ); + checksum = t->firstParam( 192 ).toInt(); + + if( nick != client()->userId() ) + emit pictureChecksumNotify( nick, checksum ); +} + +void PictureNotifierTask::parsePicture( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString nick; /* key = 4 */ + int type; /* key = 13: 1 = request, 2 = notification */ + QString url; /* key = 20 */ + int checksum; /* key = 192 */ + + nick = t->firstParam( 4 ); + url = t->firstParam( 20 ); + checksum = t->firstParam( 192 ).toInt(); + type = t->firstParam( 13 ).toInt(); + + if( type == 1 ) + emit pictureRequest( nick ); + else if( type == 2 ) + emit pictureInfoNotify( nick, KURL( url ), checksum ); +} + +void PictureNotifierTask::parsePictureUploadResponse( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString url; + QString error; + + url = t->firstParam( 20 ); + error = t->firstParam( 16 ); + + if( !error.isEmpty() ) + client()->notifyError(i18n("The picture was not successfully uploaded"), error, Client::Error ); + + if( !url.isEmpty() ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Emitting url: " << url << endl; + emit pictureUploaded( url ); + } +} + +#include "picturenotifiertask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/picturenotifiertask.h b/kopete/protocols/yahoo/libkyahoo/picturenotifiertask.h new file mode 100644 index 00000000..b6580903 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/picturenotifiertask.h @@ -0,0 +1,51 @@ +/* + Kopete Yahoo Protocol + Notifies about buddy icons + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 PICTURENOTIFIERTASK_H +#define PICTURENOTIFIERTASK_H + +#include "task.h" + +class QString; +class KURL; +class YMSGTransfer; +/** +@author André Duffeck +*/ +class PictureNotifierTask : public Task +{ +Q_OBJECT +public: + PictureNotifierTask(Task *parent); + ~PictureNotifierTask(); + + bool take(Transfer *transfer); + +protected: + bool forMe( Transfer *transfer ) const; + void parsePictureChecksum( YMSGTransfer *transfer ); + void parsePictureStatus( YMSGTransfer *transfer ); + void parsePicture( YMSGTransfer *transfer ); + void parsePictureUploadResponse( YMSGTransfer *transfer ); +signals: + void pictureStatusNotify( const QString &, int ); + void pictureChecksumNotify( const QString &, int ); + void pictureInfoNotify( const QString &, KURL, int ); + void pictureRequest( const QString & ); + void pictureUploaded( const QString & ); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/pingtask.cpp b/kopete/protocols/yahoo/libkyahoo/pingtask.cpp new file mode 100644 index 00000000..022d8e7f --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/pingtask.cpp @@ -0,0 +1,46 @@ +/* + pingtask.cpp + Send a ping to the server + + Copyright (c) 2006 André Duffeck <[email protected]> + + Kopete (c) 2002-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "pingtask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> + +PingTask::PingTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +PingTask::~PingTask() +{ +} + +void PingTask::onGo() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServicePing7); + t->setParam( 0, client()->userId().local8Bit() ); + t->setId( client()->sessionID() ); + send( t ); + + setSuccess( true ); +} diff --git a/kopete/protocols/yahoo/libkyahoo/pingtask.h b/kopete/protocols/yahoo/libkyahoo/pingtask.h new file mode 100644 index 00000000..955e7304 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/pingtask.h @@ -0,0 +1,36 @@ +/* + pingtask.h + Send a ping to the server + + Copyright (c) 2006 André Duffeck <[email protected]> + + Kopete (c) 2002-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 PINGTASK_H +#define PINGTASK_H + +#include "task.h" + +/** +@author André Duffeck +*/ +class PingTask : public Task +{ +public: + PingTask(Task *parent); + ~PingTask(); + + virtual void onGo(); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/receivefiletask.cpp b/kopete/protocols/yahoo/libkyahoo/receivefiletask.cpp new file mode 100644 index 00000000..7b4f2fc3 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/receivefiletask.cpp @@ -0,0 +1,243 @@ +/* + Kopete Yahoo Protocol + Receive a file + + Copyright (c) 2006 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "receivefiletask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <qtimer.h> +#include <kdebug.h> +#include <klocale.h> +#include <kio/global.h> +#include <kio/job.h> +#include <kio/jobclasses.h> + +ReceiveFileTask::ReceiveFileTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + m_transmitted = 0; + m_file = 0; + m_transferJob = 0; +} + +ReceiveFileTask::~ReceiveFileTask() +{ + delete m_file; + m_file = 0; +} + +void ReceiveFileTask::onGo() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceFileTransfer7); + switch( m_type ) + { + case FileTransferAccept: + m_file = new QFile( m_localUrl.path() ); + if( !m_file->open( IO_WriteOnly ) ) + { + emit error( m_transferId, KIO::ERR_CANNOT_OPEN_FOR_WRITING, i18n("Could not open file for writing.") ); + setSuccess( false ); + return; + } + m_transferJob = KIO::get( m_remoteUrl, false, false ); + QObject::connect( m_transferJob, SIGNAL( result( KIO::Job* ) ), this, SLOT( slotComplete( KIO::Job* ) ) ); + QObject::connect( m_transferJob, SIGNAL( data( KIO::Job*, const QByteArray & ) ), this, SLOT( slotData( KIO::Job*, const QByteArray & ) ) ); + delete t; + break; + case FileTransfer7Accept: + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + t->setParam( 5, m_userId.local8Bit() ); + t->setParam( 265, m_remoteUrl.url().local8Bit() ); + t->setParam( 222, 3 ); + + send( t ); + break; + case FileTransfer7Reject: + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + t->setParam( 5, m_userId.local8Bit() ); + t->setParam( 265, m_remoteUrl.url().local8Bit() ); + t->setParam( 222, 4 ); + + send( t ); + break; + default: + delete t; + } +} + +bool ReceiveFileTask::take( Transfer* transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if ( !forMe( transfer ) ) + return false; + + YMSGTransfer *t = static_cast<YMSGTransfer*>(transfer); + + parseFileTransfer7Info( t ); + + return true; +} + +bool ReceiveFileTask::forMe( Transfer *transfer ) const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + + if( t->service() == Yahoo::ServiceFileTransfer7Info ) + { + // Only take this transfer if we are the corresponding task (in case of simultaneous file transfers) + if( t->firstParam( 265 ) == m_remoteUrl.url().local8Bit() ) + return true; + else + return false; + } + else + return false; +} + +void ReceiveFileTask::slotData( KIO::Job *job, const QByteArray& data ) +{ + Q_UNUSED( job ); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + m_transmitted += data.size(); + emit bytesProcessed( m_transferId, m_transmitted ); + m_file->writeBlock( data.data() , data.size() ); + +} + +void ReceiveFileTask::slotComplete( KIO::Job *job ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + KIO::TransferJob *transfer = static_cast< KIO::TransferJob * >(job); + + if( m_file ) + m_file->close(); + if ( job->error () || transfer->isErrorPage () ) + { + emit error( m_transferId, KIO::ERR_ABORTED, i18n("An error occured while downloading the file.") ); + setSuccess( false ); + } + else + { + emit complete( m_transferId ); + setSuccess( true ); + } +} + +void ReceiveFileTask::parseFileTransfer7Info( YMSGTransfer *transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if( transfer->firstParam( 249 ).toInt() == 1 ) + { + // Reject P2P Transfer offer + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceFileTransfer7Accept); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + t->setParam( 5, transfer->firstParam( 4 ) ); + t->setParam( 265, transfer->firstParam( 265 ) ); + t->setParam( 66, -3 ); + + send( t ); + } + else if( transfer->firstParam( 249 ).toInt() == 3 ) + { + m_file = new QFile( m_localUrl.path() ); + if( !m_file->open( IO_WriteOnly ) ) + { + emit error( m_transferId, KIO::ERR_CANNOT_OPEN_FOR_WRITING, i18n("Could not open file for writing.") ); + setSuccess( false ); + return; + } + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceFileTransfer7Accept); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + t->setParam( 5, transfer->firstParam( 4 ) ); + t->setParam( 265, transfer->firstParam( 265 ) ); + t->setParam( 27, transfer->firstParam( 27 ) ); + t->setParam( 249, 3 ); // Use Reflection server + t->setParam( 251, transfer->firstParam( 251 ) ); + + send( t ); + // The server expects a HTTP HEAD command prior to the GET + m_mimetypeJob = KIO::mimetype(QString::fromLatin1("http://%1/relay?token=%2&sender=%3&recver=%4") + .arg(transfer->firstParam( 250 )).arg(transfer->firstParam( 251 )).arg(m_userId).arg(client()->userId()), false); + m_mimetypeJob->addMetaData("cookies", "manual"); + m_mimetypeJob->addMetaData("setcookies", QString::fromLatin1("Cookie: T=%1; path=/; domain=.yahoo.com; Y=%2; C=%3;") + .arg(client()->tCookie()).arg(client()->yCookie()).arg(client()->cCookie()) ); + + + m_transferJob = KIO::get( QString::fromLatin1("http://%1/relay?token=%2&sender=%3&recver=%4") + .arg(transfer->firstParam( 250 )).arg(transfer->firstParam( 251 )).arg(m_userId).arg(client()->userId()), false, false ); + QObject::connect( m_transferJob, SIGNAL( result( KIO::Job* ) ), this, SLOT( slotComplete( KIO::Job* ) ) ); + QObject::connect( m_transferJob, SIGNAL( data( KIO::Job*, const QByteArray & ) ), this, SLOT( slotData( KIO::Job*, const QByteArray & ) ) ); + m_transferJob->addMetaData("cookies", "manual"); + m_transferJob->addMetaData("setcookies", QString::fromLatin1("Cookie: T=%1; path=/; domain=.yahoo.com; Y=%2; C=%3;") + .arg(client()->tCookie()).arg(client()->yCookie()).arg(client()->cCookie()) ); + } +} + +void ReceiveFileTask::setRemoteUrl( KURL url ) +{ + m_remoteUrl = url; +} + +void ReceiveFileTask::setLocalUrl( KURL url ) +{ + m_localUrl = url; +} + +void ReceiveFileTask::setTransferId( unsigned int transferId ) +{ + m_transferId = transferId; +} + +void ReceiveFileTask::setType( Type type ) +{ + m_type = type; +} + +void ReceiveFileTask::setUserId( const QString &userId ) +{ + m_userId = userId; +} + +void ReceiveFileTask::canceled( unsigned int id ) +{ + if( m_transferId != id ) + return; + + if( m_transferJob ) + m_transferJob->kill(); + + setSuccess( false ); +} + +#include "receivefiletask.moc" + diff --git a/kopete/protocols/yahoo/libkyahoo/receivefiletask.h b/kopete/protocols/yahoo/libkyahoo/receivefiletask.h new file mode 100644 index 00000000..79bcb605 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/receivefiletask.h @@ -0,0 +1,83 @@ +/* + Kopete Yahoo Protocol + Receive a file + + Copyright (c) 2006 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 RECEIVEFILETASK_H +#define RECEIVEFILETASK_H + +#include "task.h" +#include <qfile.h> +#include <kurl.h> + +class QString; +class QFile; +namespace KIO { + class Job; + class TransferJob; + class MimetypeJob; +} +class YMSGTransfer; + +/** +@author André Duffeck +*/ +class ReceiveFileTask : public Task +{ + Q_OBJECT +public: + enum Type { FileTransferAccept, FileTransfer7Accept, FileTransfer7Reject }; + ReceiveFileTask(Task *parent); + ~ReceiveFileTask(); + + virtual void onGo(); + + void setRemoteUrl( KURL url ); + void setLocalUrl( KURL url ); + void setFileName( const QString &filename ); + void setTransferId( unsigned int transferId ); + void setType( Type type ); + void setUserId( const QString & userId ); + + bool take(Transfer *transfer); + +protected: + bool forMe( Transfer *transfer ) const; + +signals: + void bytesProcessed( unsigned int, unsigned int ); + void complete( unsigned int ); + void error( unsigned int, int, const QString & ); + +private slots: + void slotData( KIO::Job *job, const QByteArray &data ); + void slotComplete( KIO::Job *job ); + void canceled( unsigned int ); + +private: + void parseFileTransfer7Info( YMSGTransfer *transfer ); + + KURL m_remoteUrl; + KURL m_localUrl; + QString m_fileName; + QString m_userId; + QFile *m_file; + KIO::TransferJob *m_transferJob; + KIO::MimetypeJob *m_mimetypeJob; + unsigned int m_transferId; + unsigned int m_transmitted; + Type m_type; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/requestpicturetask.cpp b/kopete/protocols/yahoo/libkyahoo/requestpicturetask.cpp new file mode 100644 index 00000000..6527737f --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/requestpicturetask.cpp @@ -0,0 +1,52 @@ +/* + Kopete Yahoo Protocol + Request a Picture of a Buddy + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "requestpicturetask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> + +RequestPictureTask::RequestPictureTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +RequestPictureTask::~RequestPictureTask() +{ +} + +void RequestPictureTask::onGo() +{ + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServicePicture); + t->setId( client()->sessionID() ); + t->setParam( 4, client()->userId().local8Bit()); + t->setParam( 5, m_target.local8Bit() ); + t->setParam( 13, "1" ); + send( t ); + + setSuccess( true ); +} + +void RequestPictureTask::setTarget( const QString &target ) +{ + m_target = target; +} + +#include "requestpicturetask.moc" + diff --git a/kopete/protocols/yahoo/libkyahoo/requestpicturetask.h b/kopete/protocols/yahoo/libkyahoo/requestpicturetask.h new file mode 100644 index 00000000..146f585e --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/requestpicturetask.h @@ -0,0 +1,41 @@ +/* + Kopete Yahoo Protocol + Request a Picture of a Buddy + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 REQUESTPICTURETASK_H +#define REQUESTPICTURETASK_H + +#include "task.h" + +class QString; + +/** +@author André Duffeck +*/ +class RequestPictureTask : public Task +{ +Q_OBJECT +public: + RequestPictureTask(Task *parent); + ~RequestPictureTask(); + + virtual void onGo(); + + void setTarget( const QString &target ); +private: + QString m_target; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/safedelete.cpp b/kopete/protocols/yahoo/libkyahoo/safedelete.cpp new file mode 100644 index 00000000..703e8ed3 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/safedelete.cpp @@ -0,0 +1,139 @@ +/* + safedelete.cpp - Kopete Groupwise Protocol + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Based on Iris, Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "safedelete.h" + +#include <qtimer.h> + +//---------------------------------------------------------------------------- +// SafeDelete +//---------------------------------------------------------------------------- +SafeDelete::SafeDelete() +{ + lock = 0; +} + +SafeDelete::~SafeDelete() +{ + if(lock) + lock->dying(); +} + +void SafeDelete::deleteLater(QObject *o) +{ + if(!lock) + deleteSingle(o); + else + list.append(o); +} + +void SafeDelete::unlock() +{ + lock = 0; + deleteAll(); +} + +void SafeDelete::deleteAll() +{ + if(list.isEmpty()) + return; + + QObjectListIt it(list); + for(QObject *o; (o = it.current()); ++it) + deleteSingle(o); + list.clear(); +} + +void SafeDelete::deleteSingle(QObject *o) +{ +#if QT_VERSION < 0x030000 + // roll our own QObject::deleteLater() + SafeDeleteLater *sdl = SafeDeleteLater::ensureExists(); + sdl->deleteItLater(o); +#else + o->deleteLater(); +#endif +} + +//---------------------------------------------------------------------------- +// SafeDeleteLock +//---------------------------------------------------------------------------- +SafeDeleteLock::SafeDeleteLock(SafeDelete *sd) +{ + own = false; + if(!sd->lock) { + _sd = sd; + _sd->lock = this; + } + else + _sd = 0; +} + +SafeDeleteLock::~SafeDeleteLock() +{ + if(_sd) { + _sd->unlock(); + if(own) + delete _sd; + } +} + +void SafeDeleteLock::dying() +{ + _sd = new SafeDelete(*_sd); + own = true; +} + +//---------------------------------------------------------------------------- +// SafeDeleteLater +//---------------------------------------------------------------------------- +SafeDeleteLater *SafeDeleteLater::self = 0; + +SafeDeleteLater *SafeDeleteLater::ensureExists() +{ + if(!self) + new SafeDeleteLater(); + return self; +} + +SafeDeleteLater::SafeDeleteLater() +{ + list.setAutoDelete(true); + self = this; + QTimer::singleShot(0, this, SLOT(explode())); +} + +SafeDeleteLater::~SafeDeleteLater() +{ + list.clear(); + self = 0; +} + +void SafeDeleteLater::deleteItLater(QObject *o) +{ + list.append(o); +} + +void SafeDeleteLater::explode() +{ + delete this; +} + +#include "safedelete.moc" + diff --git a/kopete/protocols/yahoo/libkyahoo/safedelete.h b/kopete/protocols/yahoo/libkyahoo/safedelete.h new file mode 100644 index 00000000..e8215c06 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/safedelete.h @@ -0,0 +1,79 @@ +/* + gwclientstream.h - Kopete Groupwise Protocol + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Based on Iris, Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 SAFEDELETE_H +#define SAFEDELETE_H + +#include<qobject.h> +#include<qobjectlist.h> + +class SafeDelete; +class SafeDeleteLock +{ +public: + SafeDeleteLock(SafeDelete *sd); + ~SafeDeleteLock(); + +private: + SafeDelete *_sd; + bool own; + friend class SafeDelete; + void dying(); +}; + +class SafeDelete +{ +public: + SafeDelete(); + ~SafeDelete(); + + void deleteLater(QObject *o); + + // same as QObject::deleteLater() + static void deleteSingle(QObject *o); + +private: + QObjectList list; + void deleteAll(); + + friend class SafeDeleteLock; + SafeDeleteLock *lock; + void unlock(); +}; + +class SafeDeleteLater : public QObject +{ + Q_OBJECT +public: + static SafeDeleteLater *ensureExists(); + void deleteItLater(QObject *o); + +private slots: + void explode(); + +private: + SafeDeleteLater(); + ~SafeDeleteLater(); + + QObjectList list; + friend class SafeDelete; + static SafeDeleteLater *self; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/sendauthresptask.cpp b/kopete/protocols/yahoo/libkyahoo/sendauthresptask.cpp new file mode 100644 index 00000000..7c40e708 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sendauthresptask.cpp @@ -0,0 +1,73 @@ +/* + Kopete Yahoo Protocol + Send a authorization request response + + Copyright (c) 2006 André Duffeck <[email protected]> + Kopete (c) 2003-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "sendauthresptask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> + +SendAuthRespTask::SendAuthRespTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +SendAuthRespTask::~SendAuthRespTask() +{ +} + +void SendAuthRespTask::onGo() +{ + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceAuthorization); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + t->setParam( 5, m_target.local8Bit() ); + if( m_granted ) + { + t->setParam( 13, 1 ); + } + else + { + t->setParam( 13, 2 ); + t->setParam( 97, 1 ); // UTF + t->setParam( 14, m_msg.utf8() ); + + } + send( t ); + + setSuccess( true ); +} + +void SendAuthRespTask::setGranted( bool granted ) +{ + m_granted = granted; +} + +void SendAuthRespTask::setTarget( const QString &to ) +{ + m_target = to; +} + +void SendAuthRespTask::setMessage( const QString &msg ) +{ + m_msg = msg; +} + + +#include "sendauthresptask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/sendauthresptask.h b/kopete/protocols/yahoo/libkyahoo/sendauthresptask.h new file mode 100644 index 00000000..8c0beb90 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sendauthresptask.h @@ -0,0 +1,46 @@ +/* + Kopete Yahoo Protocol + Send a authorization request response + + Copyright (c) 2006 André Duffeck <[email protected]> + Kopete (c) 2003-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 SENDAUTHRESPTASK_H +#define SENDAUTHRESPTASK_H + +#include "task.h" + +class QString; + +/** +@author André Duffeck +*/ +class SendAuthRespTask : public Task +{ +Q_OBJECT +public: + SendAuthRespTask(Task *parent); + ~SendAuthRespTask(); + + virtual void onGo(); + + void setGranted( bool ); + void setTarget( const QString &to ); + void setMessage( const QString &msg ); +private: + QString m_target; + bool m_granted; + QString m_msg; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/sendfiletask.cpp b/kopete/protocols/yahoo/libkyahoo/sendfiletask.cpp new file mode 100644 index 00000000..d0f843f2 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sendfiletask.cpp @@ -0,0 +1,189 @@ +/* + Kopete Yahoo Protocol + Send a file + + Copyright (c) 2006 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "sendfiletask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <qtimer.h> +#include <kdebug.h> +#include <klocale.h> +#include <kstreamsocket.h> +#include <kio/global.h> + +using namespace KNetwork; + +SendFileTask::SendFileTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + m_transmitted = 0; + m_socket = 0; +} + +SendFileTask::~SendFileTask() +{ + m_socket->deleteLater(); + m_socket = 0; +} + +void SendFileTask::onGo() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QTimer::singleShot( 0, this, SLOT(initiateUpload()) ); +} + +void SendFileTask::initiateUpload() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + m_socket = new KStreamSocket( "filetransfer.msg.yahoo.com", QString::number(80) ); + m_socket->setBlocking( true ); + connect( m_socket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( connectSucceeded() ) ); + connect( m_socket, SIGNAL( gotError(int) ), this, SLOT( connectFailed(int) ) ); + + m_socket->connect(); +} + +void SendFileTask::connectFailed( int i ) +{ + QString err = m_socket->errorString(); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << i << ": " << err << endl; + emit error( m_transferId, i, err ); + setSuccess( false ); +} + +void SendFileTask::connectSucceeded() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer t( Yahoo::ServiceFileTransfer ); + + m_file.setName( m_url.path() ); + + t.setId( client()->sessionID() ); + t.setParam( 0, client()->userId().local8Bit()); + t.setParam( 5, m_target.local8Bit()); + t.setParam( 28, m_file.size() ); + t.setParam( 27, m_url.fileName().local8Bit() ); + t.setParam( 14, "" ); + QByteArray buffer; + QByteArray paket; + QDataStream stream( buffer, IO_WriteOnly ); + + if ( m_file.open(IO_ReadOnly ) ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "File successfully opened. Reading..." << endl; + } + else + { + client()->notifyError( i18n( "An error occured sending the file." ), m_file.errorString(), Client::Error ); + setSuccess( false ); + return; + } + + paket = t.serialize(); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Sizes: File (" << m_url << "): " << m_file.size() << " - paket: " << paket.size() << endl; + QString header = QString::fromLatin1("POST http://filetransfer.msg.yahoo.com:80/notifyft HTTP/1.1\r\n" + "Cookie: Y=%1; T=%2; C=%3 ;B=fckeert1kk1nl&b=2\r\n" + "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" + "Host: filetransfer.msg.yahoo.com:80\r\n" + "Content-length: %4\r\n" + "Cache-Control: no-cache\r\n\r\n").arg(client()->yCookie()).arg(client()->tCookie()).arg(client()->cCookie()).arg(m_file.size()+4+paket.size()); + stream.writeRawBytes( header.local8Bit(), header.length() ); + stream.writeRawBytes( paket.data(), paket.size() ); + stream << (Q_INT8)0x32 << (Q_INT8)0x39 << (Q_INT8)0xc0 << (Q_INT8)0x80; + + if( !m_socket->writeBlock( buffer, buffer.size() ) ) + { + emit error( m_transferId, m_socket->error(), m_socket->errorString() ); + m_socket->close(); + } + else + { + connect( m_socket, SIGNAL(readyWrite()), this, SLOT(transmitData()) ); + m_socket->enableWrite( true ); + } +} + +void SendFileTask::transmitData() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + int read = 0; + int written = 0; + char buf[1024]; + + m_socket->enableWrite( false ); + read = m_file.readBlock( buf, 1024 ); + written = m_socket->writeBlock( buf, read ); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "read:" << read << " written: " << written << endl; + + m_transmitted += read; + emit bytesProcessed( m_transferId, m_transmitted ); + + if( written != read ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Upload Failed!" << endl; + emit error( m_transferId, m_socket->error(), m_socket->errorString() ); + setSuccess( false ); + return; + } + if( m_transmitted == m_file.size() ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Upload Successful: " << m_transmitted << endl; + emit complete( m_transferId ); + setSuccess( true ); + m_socket->close(); + } + else + { + m_socket->enableWrite( true ); + } +} +void SendFileTask::setTarget( const QString &to ) +{ + m_target = to; +} + +void SendFileTask::setMessage( const QString &msg ) +{ + m_msg = msg; +} + +void SendFileTask::setFileUrl( KURL url ) +{ + m_url = url; + +} + +void SendFileTask::setTransferId( unsigned int transferId ) +{ + m_transferId = transferId; +} + +void SendFileTask::canceled( unsigned int id ) +{ + if( m_transferId != id ) + return; + + if( m_socket ) + m_socket->close(); + + setSuccess( false ); +} + +#include "sendfiletask.moc" + diff --git a/kopete/protocols/yahoo/libkyahoo/sendfiletask.h b/kopete/protocols/yahoo/libkyahoo/sendfiletask.h new file mode 100644 index 00000000..41e62f77 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sendfiletask.h @@ -0,0 +1,68 @@ +/* + Kopete Yahoo Protocol + Send a file + + Copyright (c) 2006 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 SENDFILETASK_H +#define SENDFILETASK_H + +#include "task.h" +#include <kurl.h> +#include <qfile.h> + +class QString; +namespace KNetwork{ + class KStreamSocket; +} + +/** +@author André Duffeck +*/ +class SendFileTask : public Task +{ + Q_OBJECT +public: + SendFileTask(Task *parent); + ~SendFileTask(); + + virtual void onGo(); + + void setTarget( const QString &to ); + void setMessage( const QString &msg ); + void setFileUrl( KURL url ); + void setTransferId( unsigned int transferId ); + +signals: + void bytesProcessed( unsigned int, unsigned int ); + void complete( unsigned int ); + void error( unsigned int, int, const QString & ); + +private slots: + void initiateUpload(); + void connectSucceeded(); + void connectFailed( int ); + void transmitData(); + void canceled( unsigned int ); + +private: + QString m_msg; + QString m_target; + KURL m_url; + QFile m_file; + unsigned int m_transferId; + unsigned int m_transmitted; + KNetwork::KStreamSocket *m_socket; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/sendmessagetask.cpp b/kopete/protocols/yahoo/libkyahoo/sendmessagetask.cpp new file mode 100644 index 00000000..d93ffcb9 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sendmessagetask.cpp @@ -0,0 +1,80 @@ +/* + Kopete Yahoo Protocol + Send a message + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "sendmessagetask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> +#include <klocale.h> + +SendMessageTask::SendMessageTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +SendMessageTask::~SendMessageTask() +{ +} + +void SendMessageTask::onGo() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if( m_text.isEmpty() ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Text to send is empty." << endl; + client()->notifyError( i18n( "An error occured sending the message" ), i18n( "The message is empty." ), Client::Debug ); + return; + } + uint pos=0; + + // split messages that are longer than 800 chars. they get dropped otherwise + while( pos < m_text.length() ) + { + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceMessage, Yahoo::StatusOffline); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit() ); + t->setParam( 5, m_target.local8Bit() ); + t->setParam( 14, m_text.mid( pos, 700).utf8() ); + t->setParam( 63, ";0" ); + t->setParam( 64, "0" ); + t->setParam( 97, 1 ); // UTF-8 + t->setParam( 206, client()->pictureFlag() ); + send( t ); + + pos += 700; + } + + setSuccess( true ); +} + +void SendMessageTask::setTarget( const QString &to ) +{ + m_target = to; +} + +void SendMessageTask::setText( const QString &text ) +{ + m_text = text; +} + +void SendMessageTask::setPicureFlag( int flag ) +{ + m_pictureFlag = flag; +} diff --git a/kopete/protocols/yahoo/libkyahoo/sendmessagetask.h b/kopete/protocols/yahoo/libkyahoo/sendmessagetask.h new file mode 100644 index 00000000..41a44ded --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sendmessagetask.h @@ -0,0 +1,44 @@ +/* + Kopete Yahoo Protocol + Send a message + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 SENDMESSAGETASK_H +#define SENDMESSAGETASK_H + +#include "task.h" + +class QString; + +/** +@author André Duffeck +*/ +class SendMessageTask : public Task +{ +public: + SendMessageTask(Task *parent); + ~SendMessageTask(); + + virtual void onGo(); + + void setText( const QString &text ); + void setTarget( const QString &to ); + void setPicureFlag( int flag ); +private: + QString m_text; + QString m_target; + int m_pictureFlag; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/sendnotifytask.cpp b/kopete/protocols/yahoo/libkyahoo/sendnotifytask.cpp new file mode 100644 index 00000000..8fd56115 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sendnotifytask.cpp @@ -0,0 +1,80 @@ +/* + Kopete Yahoo Protocol + Send a notification + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "sendnotifytask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <kdebug.h> + +SendNotifyTask::SendNotifyTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +SendNotifyTask::~SendNotifyTask() +{ +} + +void SendNotifyTask::onGo() +{ + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceNotify); + t->setId( client()->sessionID() ); + t->setStatus( Yahoo::StatusNotify ); + t->setParam( 4, client()->userId().local8Bit() ); + t->setParam( 5, m_target.local8Bit() ); + t->setParam( 14, " " ); + switch( m_type ) + { + case NotifyTyping: + t->setParam( 13, m_state ); + t->setParam( 49, "TYPING" ); + break; + case NotifyWebcamInvite: + t->setParam( 13, 0 ); + t->setParam( 49, "WEBCAMINVITE" ); + break; + case NotifyGame: + default: + setSuccess( false ); + delete t; + return; + break; + } + send( t ); + + setSuccess( true ); +} + +void SendNotifyTask::setType( Type type ) +{ + m_type = type; +} + +void SendNotifyTask::setTarget( const QString &to ) +{ + m_target = to; +} + +void SendNotifyTask::setState( State state) +{ + m_state = state; +} + + +#include "sendnotifytask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/sendnotifytask.h b/kopete/protocols/yahoo/libkyahoo/sendnotifytask.h new file mode 100644 index 00000000..6eb9f6dd --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sendnotifytask.h @@ -0,0 +1,48 @@ +/* + Kopete Yahoo Protocol + Send a notification + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 SENDNOTIFYTASK_H +#define SENDNOTIFYTASK_H + +#include "task.h" + +class QString; + +/** +@author André Duffeck +*/ +class SendNotifyTask : public Task +{ +Q_OBJECT +public: + enum Type { NotifyTyping, NotifyWebcamInvite, NotifyGame }; + enum State { Active = 1, NotActive = 0 }; + + SendNotifyTask(Task *parent); + ~SendNotifyTask(); + + virtual void onGo(); + + void setType( Type type ); + void setTarget( const QString &to ); + void setState( State ); +private: + QString m_target; + Type m_type; + State m_state; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/sendpicturetask.cpp b/kopete/protocols/yahoo/libkyahoo/sendpicturetask.cpp new file mode 100644 index 00000000..c1b1f5f0 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sendpicturetask.cpp @@ -0,0 +1,247 @@ +/* + Kopete Yahoo Protocol + sendpicturetask.cpp - Send our picture or information about it + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "sendpicturetask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <qfile.h> +#include <qcstring.h> +#include <qdatastream.h> +#include <kio/global.h> +#include <kio/job.h> +#include <kio/jobclasses.h> +#include <kbufferedsocket.h> +#include <kdebug.h> +#include <klocale.h> + +using namespace KNetwork; + +SendPictureTask::SendPictureTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + m_socket = 0; +} + +SendPictureTask::~SendPictureTask() +{ + delete m_socket; +} + +void SendPictureTask::onGo() +{ + switch( m_type ) + { + case UploadPicture: + initiateUpload(); + break; + case SendChecksum: + sendChecksum(); + break; + case SendInformation: + sendInformation(); + case SendStatus: + sendStatus(); + break; + } +} + +void SendPictureTask::initiateUpload() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + m_socket = new KBufferedSocket( "filetransfer.msg.yahoo.com", QString::number(80) ); + connect( m_socket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( connectSucceeded() ) ); + connect( m_socket, SIGNAL( gotError(int) ), this, SLOT( connectFailed(int) ) ); + + m_socket->connect(); +} + +void SendPictureTask::connectFailed( int i) +{ + m_socket->close(); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << i << ": " << static_cast<const KBufferedSocket*>( sender() )->errorString() << endl; + client()->notifyError(i18n("The picture was not successfully uploaded"), QString("%1 - %2").arg(i).arg(static_cast<const KBufferedSocket*>( sender() )->errorString()), Client::Error ); + setSuccess( false ); +} + +void SendPictureTask::connectSucceeded() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer t(Yahoo::ServicePictureUpload); + + QFile file( m_path ); + + t.setId( client()->sessionID() ); + t.setParam( 1, client()->userId().local8Bit()); + t.setParam( 38, 604800); + t.setParam( 0, client()->userId().local8Bit()); + t.setParam( 28, file.size() ); + t.setParam( 27, m_fileName.local8Bit() ); + t.setParam( 14, "" ); + QByteArray buffer; + QByteArray paket; + QDataStream stream( buffer, IO_WriteOnly ); + + if ( file.open(IO_ReadOnly ) ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "File successfully opened. Reading..." << endl; + } + else + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Error opening file: " << file.errorString() << endl; + client()->notifyError(i18n("Error opening file: %1").arg(m_path), file.errorString(), Client::Error ); + return; + } + + paket = t.serialize(); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Sizes: File (" << m_path << "): " << file.size() << " - paket: " << paket.size() << endl; + QString header = QString::fromLatin1("POST /notifyft HTTP/1.1\r\n" + "Cookie: Y=%1; T=%2; C=%3 ;\r\n" + "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" + "Host: filetransfer.msg.yahoo.com\r\n" + "Content-length: %4\r\n" + "Cache-Control: no-cache\r\n\r\n").arg(client()->yCookie()).arg(client()->tCookie()).arg(client()->cCookie()).arg(file.size()+4+paket.size()); + stream.writeRawBytes( header.local8Bit(), header.length() ); + stream.writeRawBytes( paket.data(), paket.size() ); + stream << (Q_INT8)0x32 << (Q_INT8)0x39 << (Q_INT8)0xc0 << (Q_INT8)0x80; + stream.writeRawBytes( file.readAll(), file.size() ); + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Buffersize: " << buffer.size() << endl; + if( m_socket->writeBlock( buffer, buffer.size() ) ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Upload Successful." << endl; + connect( m_socket, SIGNAL( readyRead() ), this, SLOT( readResult() ) ); + } + else + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Upload Failed." << endl; + m_socket->close(); + setSuccess( false ); + } +} + +void SendPictureTask::readResult() +{ + QByteArray ar( m_socket->bytesAvailable() ); + m_socket->readBlock ( ar.data (), ar.size () ); + QString buf( ar ); + + m_socket->close(); + if( buf.find( "error", 0, false ) >= 0 ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Picture upload failed" << endl; + setSuccess( false ); + } + else + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Picture upload acknowledged." << endl; + setSuccess( true ); + } + +} + +void SendPictureTask::sendChecksum() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServicePictureChecksum); + t->setId( client()->sessionID() ); + t->setParam(1, client()->userId().local8Bit()); + if( !m_target.isEmpty() ) + t->setParam( 5, m_target.local8Bit() ); + t->setParam(192, m_checksum); + t->setParam(212, 1); + send( t ); + + setSuccess( true ); +} + +void SendPictureTask::sendInformation() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServicePicture); + t->setId( client()->sessionID() ); + t->setParam(1, client()->userId().local8Bit()); + t->setParam(4, client()->userId().local8Bit()); + t->setParam(13, 2 ); + t->setParam(5, m_target.local8Bit() ); + t->setParam(20, m_url.local8Bit() ); + t->setParam(192, m_checksum); + + send( t ); + + setSuccess( true ); +} + +void SendPictureTask::sendStatus() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServicePictureUpdate); + t->setId( client()->sessionID() ); + t->setParam(1, client()->userId().local8Bit()); + t->setParam(5, m_target.local8Bit() ); + t->setParam(206, m_status ); + + send( t ); + + setSuccess( true ); +} + +void SendPictureTask::setType( Type type ) +{ + m_type = type; +} + +void SendPictureTask::setTarget( const QString &to ) +{ + m_target = to; +} + +void SendPictureTask::setFilename( const QString &filename ) +{ + m_fileName = filename; +} + +void SendPictureTask::setFilesize( int filesize ) +{ + m_fileSize = filesize; +} + +void SendPictureTask::setPath( const QString &path ) +{ + m_path = path; +} + +void SendPictureTask::setChecksum( int checksum ) +{ + m_checksum = checksum; +} + +void SendPictureTask::setStatus( int status ) +{ + m_status = status; +} + +void SendPictureTask::setUrl( const QString &url ) +{ + m_url = url; +} + +#include "sendpicturetask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/sendpicturetask.h b/kopete/protocols/yahoo/libkyahoo/sendpicturetask.h new file mode 100644 index 00000000..da008eb5 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sendpicturetask.h @@ -0,0 +1,77 @@ +/* + Kopete Yahoo Protocol + sendpicturetask.h - Send our picture or information about it + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 SENDPICTURETASK_H +#define SENDPICTURETASK_H + +#include "task.h" + +class QString; +class QFile; +namespace KIO { + class Job; + class TransferJob; +} +namespace KNetwork { + class KBufferedSocket; +} + +/** +@author André Duffeck +*/ +class SendPictureTask : public Task +{ +Q_OBJECT +public: + enum Type { UploadPicture, SendChecksum, SendInformation, SendStatus }; + + SendPictureTask(Task *parent); + ~SendPictureTask(); + + virtual void onGo(); + + void setType( Type type ); + void setTarget( const QString &to ); + void setFilename( const QString & ); + void setFilesize( int ); + void setPath( const QString & ); + void setChecksum( int ); + void setStatus( int ); + void setUrl( const QString & ); +private: + void initiateUpload(); + void sendChecksum(); + void sendInformation(); + void sendStatus(); +private slots: + void connectSucceeded(); + void connectFailed( int ); + void readResult(); +private: + Type m_type; + QString m_target; + QString m_fileName; + int m_fileSize; + QString m_path; + int m_checksum; + int m_status; + QString m_url; + int m_transmitted; + QFile *m_file; + KNetwork::KBufferedSocket *m_socket; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/sha1.c b/kopete/protocols/yahoo/libkyahoo/sha1.c new file mode 100644 index 00000000..c9a0edbf --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sha1.c @@ -0,0 +1,628 @@ +/*- + * Copyright (c) 2001-2003 Allan Saddi <[email protected]> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY ALLAN SADDI AND HIS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL ALLAN SADDI OR HIS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + */ + +/* + * Define WORDS_BIGENDIAN if compiling on a big-endian architecture. + * + * Define SHA1_TEST to test the implementation using the NIST's + * sample messages. The output should be: + * + * a9993e36 4706816a ba3e2571 7850c26c 9cd0d89d + * 84983e44 1c3bd26e baae4aa1 f95129e5 e54670f1 + * 34aa973c d4c4daa4 f61eeb2b dbad2731 6534016f + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif /* HAVE_CONFIG_H */ + +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif + +#include <string.h> + +#include "sha1.h" + +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* !lint */ + +#define ROTL(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) +#define ROTR(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) + +#define F_0_19(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define F_20_39(x, y, z) ((x) ^ (y) ^ (z)) +#define F_40_59(x, y, z) (((x) & ((y) | (z))) | ((y) & (z))) +#define F_60_79(x, y, z) ((x) ^ (y) ^ (z)) + +#define DO_ROUND(F, K) { \ + temp = ROTL(a, 5) + F(b, c, d) + e + *(W++) + K; \ + e = d; \ + d = c; \ + c = ROTL(b, 30); \ + b = a; \ + a = temp; \ +} + +#define K_0_19 0x5a827999L +#define K_20_39 0x6ed9eba1L +#define K_40_59 0x8f1bbcdcL +#define K_60_79 0xca62c1d6L + +#ifndef RUNTIME_ENDIAN + +#ifdef WORDS_BIGENDIAN + +#define BYTESWAP(x) (x) +#define BYTESWAP64(x) (x) + +#else /* WORDS_BIGENDIAN */ + +#define BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | (ROTL((x), 8) & 0x00ff00ffL)) + +static uint64_t _byteswap64(uint64_t x) +{ + uint32_t a = x >> 32; + uint32_t b = (uint32_t) x; + return ((uint64_t) BYTESWAP(b) << 32) | (uint64_t) BYTESWAP(a); +} + +#define BYTESWAP64(x) _byteswap64(x) + + + +#endif /* WORDS_BIGENDIAN */ + +#else /* !RUNTIME_ENDIAN */ + +#define BYTESWAP(x) _byteswap(sc->littleEndian, x) +#define BYTESWAP64(x) _byteswap64(sc->littleEndian, x) + +#define _BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \ + (ROTL((x), 8) & 0x00ff00ffL)) +#define _BYTESWAP64(x) __byteswap64(x) + +static uint64_t __byteswap64(uint64_t x) +{ + uint32_t a = x >> 32; + uint32_t b = (uint32_t) x; + return ((uint64_t) _BYTESWAP(b) << 32) | (uint64_t) _BYTESWAP(a); +} + +static uint32_t _byteswap(int littleEndian, uint32_t x) +{ + if (!littleEndian) + return x; + else + return _BYTESWAP(x); +} + +static uint64_t _byteswap64(int littleEndian, uint64_t x) +{ + if (!littleEndian) + return x; + else + return _BYTESWAP64(x); +} + +static void setEndian(int *littleEndianp) +{ + union { + uint32_t w; + uint8_t b[4]; + } endian; + + endian.w = 1L; + *littleEndianp = endian.b[0] != 0; +} + +#endif /* !RUNTIME_ENDIAN */ + +static const uint8_t padding[64] = { + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +void +SHA1Init (SHA1Context *sc) +{ +#ifdef RUNTIME_ENDIAN + setEndian (&sc->littleEndian); +#endif /* RUNTIME_ENDIAN */ + + sc->totalLength = 0LL; + sc->hash[0] = 0x67452301L; + sc->hash[1] = 0xefcdab89L; + sc->hash[2] = 0x98badcfeL; + sc->hash[3] = 0x10325476L; + sc->hash[4] = 0xc3d2e1f0L; + sc->bufferLength = 0L; +} + +static void +burnStack (int size) +{ + char buf[128]; + + memset (buf, 0, sizeof (buf)); + size -= sizeof (buf); + if (size > 0) + burnStack (size); +} + +static void +SHA1Guts (SHA1Context *sc, const uint32_t *cbuf) +{ + uint32_t buf[80]; + uint32_t *W, *W3, *W8, *W14, *W16; + uint32_t a, b, c, d, e, temp; + int i; + + W = buf; + + for (i = 15; i >= 0; i--) { + *(W++) = BYTESWAP(*cbuf); + cbuf++; + } + + W16 = &buf[0]; + W14 = &buf[2]; + W8 = &buf[8]; + W3 = &buf[13]; + + for (i = 63; i >= 0; i--) { + *W = *(W3++) ^ *(W8++) ^ *(W14++) ^ *(W16++); + *W = ROTL(*W, 1); + W++; + } + + a = sc->hash[0]; + b = sc->hash[1]; + c = sc->hash[2]; + d = sc->hash[3]; + e = sc->hash[4]; + + W = buf; + +#ifndef SHA1_UNROLL +#define SHA1_UNROLL 20 +#endif /* !SHA1_UNROLL */ + +#if SHA1_UNROLL == 1 + for (i = 19; i >= 0; i--) + DO_ROUND(F_0_19, K_0_19); + + for (i = 19; i >= 0; i--) + DO_ROUND(F_20_39, K_20_39); + + for (i = 19; i >= 0; i--) + DO_ROUND(F_40_59, K_40_59); + + for (i = 19; i >= 0; i--) + DO_ROUND(F_60_79, K_60_79); +#elif SHA1_UNROLL == 2 + for (i = 9; i >= 0; i--) { + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + } + + for (i = 9; i >= 0; i--) { + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + } + + for (i = 9; i >= 0; i--) { + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + } + + for (i = 9; i >= 0; i--) { + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + } +#elif SHA1_UNROLL == 4 + for (i = 4; i >= 0; i--) { + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + } + + for (i = 4; i >= 0; i--) { + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + } + + for (i = 4; i >= 0; i--) { + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + } + + for (i = 4; i >= 0; i--) { + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + } +#elif SHA1_UNROLL == 5 + for (i = 3; i >= 0; i--) { + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + } + + for (i = 3; i >= 0; i--) { + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + } + + for (i = 3; i >= 0; i--) { + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + } + + for (i = 3; i >= 0; i--) { + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + } +#elif SHA1_UNROLL == 10 + for (i = 1; i >= 0; i--) { + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + } + + for (i = 1; i >= 0; i--) { + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + } + + for (i = 1; i >= 0; i--) { + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + } + + for (i = 1; i >= 0; i--) { + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + } +#elif SHA1_UNROLL == 20 + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + DO_ROUND(F_0_19, K_0_19); + + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + DO_ROUND(F_20_39, K_20_39); + + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + DO_ROUND(F_40_59, K_40_59); + + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); + DO_ROUND(F_60_79, K_60_79); +#else /* SHA1_UNROLL */ +#error SHA1_UNROLL must be 1, 2, 4, 5, 10 or 20! +#endif + + sc->hash[0] += a; + sc->hash[1] += b; + sc->hash[2] += c; + sc->hash[3] += d; + sc->hash[4] += e; +} + +void +SHA1Update (SHA1Context *sc, const void *vdata, uint32_t len) +{ + const uint8_t *data = vdata; + uint32_t bufferBytesLeft; + uint32_t bytesToCopy; + int needBurn = 0; + +#ifdef SHA1_FAST_COPY + if (sc->bufferLength) { + bufferBytesLeft = 64L - sc->bufferLength; + + bytesToCopy = bufferBytesLeft; + if (bytesToCopy > len) + bytesToCopy = len; + + memcpy (&sc->buffer.bytes[sc->bufferLength], data, bytesToCopy); + + sc->totalLength += bytesToCopy * 8L; + + sc->bufferLength += bytesToCopy; + data += bytesToCopy; + len -= bytesToCopy; + + if (sc->bufferLength == 64L) { + SHA1Guts (sc, sc->buffer.words); + needBurn = 1; + sc->bufferLength = 0L; + } + } + + while (len > 63) { + sc->totalLength += 512L; + + SHA1Guts (sc, data); + needBurn = 1; + + data += 64L; + len -= 64L; + } + + if (len) { + memcpy (&sc->buffer.bytes[sc->bufferLength], data, len); + + sc->totalLength += len * 8L; + + sc->bufferLength += len; + } +#else /* SHA1_FAST_COPY */ + while (len) { + bufferBytesLeft = 64L - sc->bufferLength; + + bytesToCopy = bufferBytesLeft; + if (bytesToCopy > len) + bytesToCopy = len; + + memcpy (&sc->buffer.bytes[sc->bufferLength], data, bytesToCopy); + + sc->totalLength += bytesToCopy * 8L; + + sc->bufferLength += bytesToCopy; + data += bytesToCopy; + len -= bytesToCopy; + + if (sc->bufferLength == 64L) { + SHA1Guts (sc, sc->buffer.words); + needBurn = 1; + sc->bufferLength = 0L; + } + } +#endif /* SHA1_FAST_COPY */ + + if (needBurn) + burnStack (sizeof (uint32_t[86]) + sizeof (uint32_t *[5]) + sizeof (int)); +} + +void +SHA1Final (SHA1Context *sc, uint8_t hash[SHA1_HASH_SIZE]) +{ + uint32_t bytesToPad; + uint64_t lengthPad; + int i; + + bytesToPad = 120L - sc->bufferLength; + if (bytesToPad > 64L) + bytesToPad -= 64L; + + lengthPad = BYTESWAP64(sc->totalLength); + + SHA1Update (sc, padding, bytesToPad); + SHA1Update (sc, &lengthPad, 8L); + + if (hash) { + for (i = 0; i < SHA1_HASH_WORDS; i++) { +#ifdef SHA1_FAST_COPY + *((uint32_t *) hash) = BYTESWAP(sc->hash[i]); +#else /* SHA1_FAST_COPY */ + hash[0] = (uint8_t) (sc->hash[i] >> 24); + hash[1] = (uint8_t) (sc->hash[i] >> 16); + hash[2] = (uint8_t) (sc->hash[i] >> 8); + hash[3] = (uint8_t) sc->hash[i]; +#endif /* SHA1_FAST_COPY */ + hash += 4; + } + } +} + +#ifdef SHA1_TEST + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int +main (int argc, char *argv[]) +{ + SHA1Context foo; + uint8_t hash[SHA1_HASH_SIZE]; + char buf[1000]; + int i; + + SHA1Init (&foo); + SHA1Update (&foo, "abc", 3); + SHA1Final (&foo, hash); + + for (i = 0; i < SHA1_HASH_SIZE;) { + printf ("%02x", hash[i++]); + if (!(i % 4)) + printf (" "); + } + printf ("\n"); + + SHA1Init (&foo); + SHA1Update (&foo, + "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + 56); + SHA1Final (&foo, hash); + + for (i = 0; i < SHA1_HASH_SIZE;) { + printf ("%02x", hash[i++]); + if (!(i % 4)) + printf (" "); + } + printf ("\n"); + + SHA1Init (&foo); + memset (buf, 'a', sizeof (buf)); + for (i = 0; i < 1000; i++) + SHA1Update (&foo, buf, sizeof (buf)); + SHA1Final (&foo, hash); + + for (i = 0; i < SHA1_HASH_SIZE;) { + printf ("%02x", hash[i++]); + if (!(i % 4)) + printf (" "); + } + printf ("\n"); + + exit (0); +} + +#endif /* SHA1_TEST */ diff --git a/kopete/protocols/yahoo/libkyahoo/sha1.h b/kopete/protocols/yahoo/libkyahoo/sha1.h new file mode 100644 index 00000000..02a4c732 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/sha1.h @@ -0,0 +1,72 @@ +/*- + * Copyright (c) 2001-2003 Allan Saddi <[email protected]> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY ALLAN SADDI AND HIS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL ALLAN SADDI OR HIS CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $Id$ + */ + +#ifndef _SHA1_H +#define _SHA1_H + +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif + +#define SHA1_HASH_SIZE 20 + +/* Hash size in 32-bit words */ +#define SHA1_HASH_WORDS 5 + +struct _SHA1Context { + uint64_t totalLength; + uint32_t hash[SHA1_HASH_WORDS]; + uint32_t bufferLength; + union { + uint32_t words[16]; + uint8_t bytes[64]; + } buffer; +#ifdef RUNTIME_ENDIAN + int littleEndian; +#endif /* RUNTIME_ENDIAN */ +}; + +typedef struct _SHA1Context SHA1Context; + +#ifdef __cplusplus +extern "C" { +#endif + +void SHA1Init (SHA1Context *sc); +void SHA1Update (SHA1Context *sc, const void *data, uint32_t len); +void SHA1Final (SHA1Context *sc, uint8_t hash[SHA1_HASH_SIZE]); + +#ifdef __cplusplus +} +#endif + +#endif /* _SHA1_H */ diff --git a/kopete/protocols/yahoo/libkyahoo/statusnotifiertask.cpp b/kopete/protocols/yahoo/libkyahoo/statusnotifiertask.cpp new file mode 100644 index 00000000..763d560c --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/statusnotifiertask.cpp @@ -0,0 +1,184 @@ +/* + Kopete Yahoo Protocol + Notifies about status changes of buddies + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "statusnotifiertask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <qstringlist.h> +#include <kdebug.h> +#include <klocale.h> + +StatusNotifierTask::StatusNotifierTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +StatusNotifierTask::~StatusNotifierTask() +{ + +} + +bool StatusNotifierTask::take( Transfer* transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if ( !forMe( transfer ) ) + return false; + + YMSGTransfer *t = static_cast<YMSGTransfer*>(transfer); + + if( t->service() == Yahoo::ServiceStealthOffline ) + parseStealthStatus( t ); + else if( t->service() == Yahoo::ServiceAuthorization ) + parseAuthorization( t ); + else + parseStatus( t ); + + return true; +} + +bool StatusNotifierTask::forMe( Transfer* transfer ) const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + + if ( t->service() == Yahoo::ServiceLogon || + t->service() == Yahoo::ServiceLogoff || + t->service() == Yahoo::ServiceIsAway || + t->service() == Yahoo::ServiceIsBack || + t->service() == Yahoo::ServiceGameLogon || + t->service() == Yahoo::ServiceGameLogoff || + t->service() == Yahoo::ServiceIdAct || + t->service() == Yahoo::ServiceIddeAct || + t->service() == Yahoo::ServiceStatus || + t->service() == Yahoo::ServiceStealthOffline || + t->service() == Yahoo::ServiceAuthorization + ) + return true; + else + return false; +} + +void StatusNotifierTask::parseStatus( YMSGTransfer* t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if( t->status() == Yahoo::StatusDisconnected && + t->service() == Yahoo::ServiceLogoff ) + { + emit loginResponse( Yahoo::LoginDupl, QString::null ); + } + + QString myNick; /* key = 1 */ + QString customError; /* key = 16 */ + QString nick; /* key = 7 */ + int state; /* key = 10 */ + QString message; /* key = 19 */ + int flags; /* key = 13 */ + int away; /* key = 47 */ + int idle; /* key = 137 */ + bool utf; /* key = 97 */ + int checksum; /* key = 192 */ + + customError = t->firstParam( 16 ); + if( !customError.isEmpty() ) + client()->notifyError( i18n("An unknown error has occured."), customError, Client::Warning ); + + myNick = t->firstParam( 1 ); + + for( int i = 0; i < t->paramCount( 7 ); ++i) + { + nick = t->nthParam( 7, i ); + state = t->nthParamSeparated( 10, i, 7 ).toInt(); + flags = t->nthParamSeparated( 13, i, 7 ).toInt(); + away = t->nthParamSeparated( 47, i, 7 ).toInt(); + idle = t->nthParamSeparated( 137, i, 7 ).toInt(); + utf = t->nthParamSeparated( 97, i, 7 ).toInt() == 1; + checksum = t->nthParamSeparated( 192, i, 7 ).toInt(); + if( utf ) + message = QString::fromUtf8( t->nthParamSeparated( 19, i, 7 ) ); + else + message = t->nthParamSeparated( 19, i, 7 ); + + if( t->service() == Yahoo::ServiceLogoff || ( state != 0 && flags == 0 ) ) + emit statusChanged( nick, Yahoo::StatusOffline, QString::null, 0, 0 ); + else + emit statusChanged( nick, state, message, away, idle ); + + if( checksum ) + emit gotPictureChecksum( nick, checksum ); + } +} + +void StatusNotifierTask::parseAuthorization( YMSGTransfer* t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString nick; /* key = 4 */ + QString msg; /* key = 14 */ + int state; /* key = 13 */ + bool utf; /* key = 97 */ + + utf = t->firstParam( 97 ).toInt() == 1; + nick = t->firstParam( 4 ); + if( utf ) + msg = QString::fromUtf8( t->firstParam( 14 ) ); + else + msg = t->firstParam( 14 ); + state = t->firstParam( 13 ).toInt(); + + if( state == 1 ) + { + emit( authorizationAccepted( nick ) ); + } + else if( state == 2 ) + { + emit( authorizationRejected( nick, msg ) ); + } + else // This is a request + { + QString fname = t->firstParam( 216 ); + QString lname = t->firstParam( 254 ); + QString name; + if( !fname.isEmpty() || !lname.isEmpty() ) + name = QString("%1 %2").arg(fname).arg(lname); + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Emitting gotAuthorizationRequest( " << nick<< ", " << msg << ", " << name << " )" << endl; + emit gotAuthorizationRequest( nick, msg, name ); + } +} + +void StatusNotifierTask::parseStealthStatus( YMSGTransfer* t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString nick; /* key = 7 */ + int state; /* key = 31 */ + + nick = t->firstParam( 7 ); + state = t->firstParam( 31 ).toInt(); + + emit stealthStatusChanged( nick, ( state == 1 ) ? Yahoo::StealthActive : Yahoo::StealthNotActive ); +} + +#include "statusnotifiertask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/statusnotifiertask.h b/kopete/protocols/yahoo/libkyahoo/statusnotifiertask.h new file mode 100644 index 00000000..c7b45b1c --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/statusnotifiertask.h @@ -0,0 +1,53 @@ +/* + Kopete Yahoo Protocol + Notifies about status changes of buddies + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 STATUSNOTIFIERTASK_H +#define STATUSNOTIFIERTASK_H + +#include "task.h" +#include "yahootypes.h" + +class QString; +class YMSGTransfer; + +/** +@author André Duffeck +*/ +class StatusNotifierTask : public Task +{ +Q_OBJECT +public: + StatusNotifierTask(Task *parent); + ~StatusNotifierTask(); + + bool take(Transfer *transfer); + +protected: + bool forMe( Transfer *transfer ) const; + void parseStatus( YMSGTransfer *transfer ); + void parseStealthStatus( YMSGTransfer *transfer ); + void parseAuthorization( YMSGTransfer *transfer ); +signals: + void statusChanged( const QString&, int, const QString&, int, int ); + void stealthStatusChanged( const QString&, Yahoo::StealthStatus ); + void loginResponse( int, const QString& ); + void authorizationAccepted( const QString & ); + void authorizationRejected( const QString &, const QString & ); + void gotAuthorizationRequest( const QString &, const QString &, const QString & ); + void gotPictureChecksum( const QString &, int ); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/stealthtask.cpp b/kopete/protocols/yahoo/libkyahoo/stealthtask.cpp new file mode 100644 index 00000000..01ab4e27 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/stealthtask.cpp @@ -0,0 +1,76 @@ +/* + Kopete Yahoo Protocol + Stealth/Unstealth a buddy + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "stealthtask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> + +StealthTask::StealthTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +StealthTask::~StealthTask() +{ +} + +void StealthTask::onGo() +{ + YMSGTransfer *t = new YMSGTransfer(); + if( m_mode == Yahoo::StealthOnline ) + { + t->setService( Yahoo::ServiceStealthOnline ); + t->setParam( 13, "1" ); + t->setParam( 31, m_state ); + } + else if( m_mode == Yahoo::StealthOffline ) + { + t->setService( Yahoo::ServiceStealthOffline ); + t->setParam( 13, "1" ); + t->setParam( 31, m_state ); + } + else if( m_mode == Yahoo::StealthPermOffline ) + { + t->setService( Yahoo::ServiceStealthOffline ); + t->setParam( 13, "2" ); + t->setParam( 31, m_state ); + } + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit()); + if( !m_target.isEmpty() ) + t->setParam( 7, m_target.local8Bit() ); + send( t ); + + setSuccess( true ); +} + +void StealthTask::setTarget( const QString &to ) +{ + m_target = to; +} + +void StealthTask::setState( Yahoo::StealthStatus state) +{ + m_state = state; +} + +void StealthTask::setMode( Yahoo::StealthMode mode ) +{ + m_mode = mode; +} diff --git a/kopete/protocols/yahoo/libkyahoo/stealthtask.h b/kopete/protocols/yahoo/libkyahoo/stealthtask.h new file mode 100644 index 00000000..62e70340 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/stealthtask.h @@ -0,0 +1,46 @@ +/* + Kopete Yahoo Protocol + Stealth/Unstealth a buddy + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 STEALTHTASK_H +#define STEALTHTASK_H + +#include "task.h" +#include "yahootypes.h" +#include <kdebug.h> + +class QString; + +/** +@author André Duffeck +*/ +class StealthTask : public Task +{ +public: + StealthTask(Task *parent); + ~StealthTask(); + + virtual void onGo(); + + void setTarget( const QString &to ); + void setState( Yahoo::StealthStatus state ); + void setMode( Yahoo::StealthMode mode ); +private: + QString m_target; + Yahoo::StealthMode m_mode; + Yahoo::StealthStatus m_state; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/stream.cpp b/kopete/protocols/yahoo/libkyahoo/stream.cpp new file mode 100644 index 00000000..02967416 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/stream.cpp @@ -0,0 +1,31 @@ +/* + stream.cpp - Kopete Groupwise Protocol + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Based on Iris, Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "stream.h" + +Stream::Stream(QObject *parent) +:QObject(parent) +{ +} + +Stream::~Stream() +{ +} + +#include "stream.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/stream.h b/kopete/protocols/yahoo/libkyahoo/stream.h new file mode 100644 index 00000000..b5aa0452 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/stream.h @@ -0,0 +1,76 @@ +/* + stream.h - Kopete Groupwise Protocol + + Copyright (c) 2004 Matt Rogers <[email protected]> + + Based on code copyright (c) 2004 SuSE Linux AG <http://www.suse.com> + Based on Iris, Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include <qobject.h> + +#ifndef YAHOO_STREAM_H +#define YAHOO_STREAM_H + +class Transfer; + +class Stream : public QObject +{ + Q_OBJECT +public: + enum Error { ErrParse, ErrProtocol, ErrStream, ErrCustom = 10 }; + enum StreamCond + { + GenericStreamError, + Conflict, + ConnectionTimeout, + InternalServerError, + InvalidFrom, +/*# InvalidXml, // not required*/ + PolicyViolation, + ResourceConstraint, + SystemShutdown + }; + + Stream(QObject *parent=0); + virtual ~Stream(); + + virtual void close()=0; + virtual int errorCondition() const=0; + virtual QString errorText() const=0; + + /** + * Are there any messages waiting to be read + */ + virtual bool transfersAvailable() const = 0; // adapt to messages + /** + * Read a message received from the server + */ + virtual Transfer* read() = 0; + + /** + * Send a message to the server + */ + virtual void write( Transfer *request) = 0; + + +signals: + void connectionClosed(); + void delayedCloseFinished(); + void readyRead(); +// void stanzaWritten(); + void error(int); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/task.cpp b/kopete/protocols/yahoo/libkyahoo/task.cpp new file mode 100644 index 00000000..805168a9 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/task.cpp @@ -0,0 +1,265 @@ +/* + task.cpp - Kopete Groupwise Protocol + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Based on Iris, Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include <qtimer.h> + +#include "client.h" +#include "transfer.h" +#include "safedelete.h" + +#include "task.h" + +class Task::TaskPrivate +{ +public: + TaskPrivate() {} + + QString id; + bool success; + int statusCode; + QString statusString; + Client *client; + bool insignificant, deleteme, autoDelete; + bool done; + Transfer * transfer; +}; + +Task::Task(Task *parent) +:QObject(parent) +{ + init(); + d->transfer = 0; + d->client = parent->client(); + //d->id = client()->genUniqueId(); + connect(d->client, SIGNAL(disconnected()), SLOT(clientDisconnected())); +} + +Task::Task(Client *parent, bool) +:QObject(0) +{ + init(); + + d->client = parent; + connect(d->client, SIGNAL(disconnected()), SLOT(clientDisconnected())); +} + +Task::~Task() +{ + delete d; +} + +void Task::init() +{ + d = new TaskPrivate; + d->success = false; + d->insignificant = false; + d->deleteme = false; + d->autoDelete = false; + d->done = false; + d->transfer = 0; +} + +Task *Task::parent() const +{ + return (Task *)QObject::parent(); +} + +Client *Task::client() const +{ + return d->client; +} + +Transfer * Task::transfer() const +{ + return d->transfer; +} + +void Task::setTransfer( Transfer * transfer ) +{ + d->transfer = transfer; +} + +QString Task::id() const +{ + return d->id; +} + +bool Task::success() const +{ + return d->success; +} + +int Task::statusCode() const +{ + return d->statusCode; +} + +const QString & Task::statusString() const +{ + return d->statusString; +} + +void Task::go(bool autoDelete) +{ + d->autoDelete = autoDelete; + + onGo(); +} + +bool Task::take( Transfer * transfer) +{ + const QObjectList *p = children(); + if(!p) + return false; + + // pass along the transfer to our children + QObjectListIt it(*p); + Task *t; + for(; it.current(); ++it) { + QObject *obj = it.current(); + if(!obj->inherits("Task")) + continue; + + t = static_cast<Task*>(obj); + + if(t->take( transfer )) + { + qDebug( "Transfer ACCEPTED by: %s", t->className() ); + return true; + } +/* else + qDebug( "Transfer refused by: %s", t->className() );*/ + } + + return false; +} + +void Task::safeDelete() +{ + if(d->deleteme) + return; + + d->deleteme = true; + if(!d->insignificant) + SafeDelete::deleteSingle(this); +} + +void Task::onGo() +{ + qDebug( "ERROR: calling default NULL onGo() for this task, you should reimplement this!"); +} + +void Task::onDisconnect() +{ + if(!d->done) { + d->success = false; + d->statusCode = ErrDisc; + d->statusString = tr("Disconnected"); + + // delay this so that tasks that react don't block the shutdown + QTimer::singleShot(0, this, SLOT(done())); + } +} + +void Task::send( Transfer * request ) +{ + client()->send( request ); +} + +void Task::setSuccess(int code, const QString &str) +{ + if(!d->done) { + d->success = true; + d->statusCode = code; + d->statusString = str; + done(); + } +} + +void Task::setError(int code, const QString &str) +{ + if(!d->done) { + d->success = false; + d->statusCode = code; + d->statusString = str; + done(); + } +} + +void Task::done() +{ + debug("Task::done()"); + if(d->done || d->insignificant) + return; + d->done = true; + + if(d->deleteme || d->autoDelete) + d->deleteme = true; + + d->insignificant = true; + debug("emitting finished"); + finished(); + d->insignificant = false; + + if(d->deleteme) + SafeDelete::deleteSingle(this); +} + +void Task::clientDisconnected() +{ + onDisconnect(); +} + +// void Task::debug(const char *fmt, ...) +// { +// char *buf; +// QString str; +// int size = 1024; +// int r; +// +// do { +// buf = new char[size]; +// va_list ap; +// va_start(ap, fmt); +// r = vsnprintf(buf, size, fmt, ap); +// va_end(ap); +// +// if(r != -1) +// str = QString(buf); +// +// delete [] buf; +// +// size *= 2; +// } while(r == -1); +// +// debug(str); +// } + +void Task::debug(const QString &str) +{ + client()->debug(QString("%1: ").arg(className()) + str); +} + +bool Task::forMe( const Transfer * transfer ) const +{ + Q_UNUSED( transfer ); + return false; +} + +#include "task.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/task.h b/kopete/protocols/yahoo/libkyahoo/task.h new file mode 100644 index 00000000..581512b3 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/task.h @@ -0,0 +1,93 @@ +/* + task.h - Kopete Groupwise Protocol + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Based on Iris, Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 YAHOO_TASK_H +#define YAHOO_TASK_H + +#include <qobject.h> + +class QString; + +class Client; +class Request; +class Transfer; + +class Task : public QObject +{ + Q_OBJECT +public: + enum { ErrDisc }; + Task(Task *parent); + Task( Client *, bool isRoot ); + virtual ~Task(); + + Task *parent() const; + Client *client() const; + Transfer *transfer() const; + + QString id() const; + + bool success() const; + int statusCode() const; + const QString & statusString() const; + + void go( bool autoDelete=false ); + /** + * Allows a task to examine an incoming Transfer and decide whether to 'take' it + * for further processing. + */ + virtual bool take( Transfer* transfer ); + void safeDelete(); + +signals: + void finished(); + +protected: + virtual void onGo(); + virtual void onDisconnect(); + void send( Transfer * request ); + void setSuccess( int code=0, const QString &str="" ); + void setError( int code=0, const QString &str="" ); +// void debug( const char *, ... ); + void debug( const QString & ); + /** + * Used in take() to check if the offered transfer is for this Task + * @return true if this Task should take the Transfer. Default impl always returns false. + */ + virtual bool forMe( const Transfer * transfer ) const; + /** + * Creates a transfer with the given command and field list + */ + //void createTransfer( const QString & command, const Field::FieldList fields ); + /** + * Direct setter for Tasks which don't have any fields + */ + void setTransfer( Transfer * transfer ); +private slots: + void clientDisconnected(); + void done(); + +private: + void init(); + + class TaskPrivate; + TaskPrivate *d; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/tests/Makefile.am b/kopete/protocols/yahoo/libkyahoo/tests/Makefile.am new file mode 100644 index 00000000..6e644285 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/tests/Makefile.am @@ -0,0 +1,9 @@ +INCLUDES = -I$(top_srcdir)/kopete/protocols/yahoo/libkyahoo -I../ $(all_includes) +METASOURCES = AUTO +check_PROGRAMS = clientstream_test + +clientstream_test_SOURCES = clientstream_test.cpp +clientstream_test_LDADD = $(LIB_QT) $(LIB_KDECORE) ../libkyahoo.la + +#login_test_SOURCES = logintest.cpp +#login_test_LDADD = $(LIB_QT) $(LIB_KDECORE) ../libkyahoo.la diff --git a/kopete/protocols/yahoo/libkyahoo/tests/clientstream_test.cpp b/kopete/protocols/yahoo/libkyahoo/tests/clientstream_test.cpp new file mode 100644 index 00000000..a52b1f56 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/tests/clientstream_test.cpp @@ -0,0 +1,57 @@ +//Licensed under the GNU General Public License + +#include "clientstream_test.h" +#include <kdebug.h> +#include "../ymsgtransfer.h" +#include "../yahootypes.h" + +ClientStreamTest::ClientStreamTest(int argc, char ** argv) : QApplication( argc, argv ) +{ + // set up client stream + myConnector = new KNetworkConnector( 0 ); + //myConnector->setOptHostPort( "localhost", 8300 ); + myConnector->setOptHostPort( "scs.msg.yahoo.com", 5050 ); + myTestObject = new ClientStream( myConnector, myConnector); + // notify when the transport layer is connected + connect( myTestObject, SIGNAL( connected() ), SLOT( slotConnected() ) ); + // notify and start sending + //connect( myTestObject, SIGNAL( warning(int) ), SLOT( slotWarning(int) ) ); + + // do test once the event loop is running + QTimer::singleShot( 0, this, SLOT( slotDoTest() ) ); + connected = false; +} + +ClientStreamTest::~ClientStreamTest() +{ + delete myTestObject; + delete myConnector; +} + +void ClientStreamTest::slotDoTest() +{ + QString server = QString::fromLatin1("scs.msg.yahoo.com"); + // connect to server + kdDebug(14180) << k_funcinfo << " connecting to server" << endl; + myTestObject->connectToServer( server, true ); // fine up to here... +} + +void ClientStreamTest::slotConnected() +{ + kdDebug(14180) << k_funcinfo << " connection is up" << endl; + connected = true; + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceLogon); + t->setParam( 1, "kopetetest"); + + myTestObject->write(t); + while(1); +} + +int main(int argc, char ** argv) +{ + ClientStreamTest a( argc, argv ); + a.exec(); + return 0; +} + +#include "clientstream_test.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/tests/clientstream_test.h b/kopete/protocols/yahoo/libkyahoo/tests/clientstream_test.h new file mode 100644 index 00000000..ef367cec --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/tests/clientstream_test.h @@ -0,0 +1,49 @@ +// +// C++ Implementation: clientstream_test +// +// Description: +// +// +// Author: Kopete Developers <[email protected]>, (C) 2004 +// Licensed under the GNU General Public License + +#ifndef clientstream_test_h +#define clientstream_test_h + +#include <qglobal.h> +#include <qapplication.h> +#include <qtimer.h> + +#include "yahooclientstream.h" +#include "yahooconnector.h" + +#include "coreprotocol.h" + +#define QT_FATAL_ASSERT 1 + +class ClientStreamTest : public QApplication +{ +Q_OBJECT +public: + ClientStreamTest(int argc, char ** argv); + + ~ClientStreamTest(); + + bool isConnected(); + +public slots: + void slotDoTest(); + + void slotConnected(); + + //void slotWarning(int warning); + + //void slotsend(int layer); + +private: + KNetworkConnector *myConnector; + ClientStream *myTestObject; + bool connected; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/tests/logintest.cpp b/kopete/protocols/yahoo/libkyahoo/tests/logintest.cpp new file mode 100644 index 00000000..8778d9da --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/tests/logintest.cpp @@ -0,0 +1,72 @@ +/* + Kopete Yahoo Protocol Tests + + Copyright (c) 2004 Duncan Mac-Vicar P. <[email protected]> + + Based on code + Copyright (c) 2004 Matt Rogers <[email protected]> + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "logintest.h" +#include <kdebug.h> +#include "../ymsgtransfer.h" +#include "../yahootypes.h" + +LoginTest::LoginTest(int argc, char ** argv) : QApplication( argc, argv ) +{ + // set up client stream + myConnector = new KNetworkConnector( 0 ); + //myConnector->setOptHostPort( "localhost", 8300 ); + myConnector->setOptHostPort( "scs.msg.yahoo.com", 5050 ); + myClientStream = new ClientStream( myConnector, myConnector); + // notify when the transport layer is connected + myClient = new Client(); + // do test once the event loop is running + QTimer::singleShot( 0, this, SLOT( slotDoTest() ) ); + connected = false; +} + +LoginTest::~LoginTest() +{ + delete myClientStream; + delete myConnector; + delete myClient; +} + +void LoginTest::slotDoTest() +{ + QString server = QString::fromLatin1("scs.msg.yahoo.com"); + // connect to server + kdDebug(14180) << k_funcinfo << " connecting to server" << endl; + + connect( myClient, SIGNAL( connected() ), SLOT( slotConnected() ) ); + myClient->start( server, 5050, "duncanmacvicar", "**********" ); + myClient->connectToServer( myClientStream, server, true ); +} + +void LoginTest::slotConnected() +{ + kdDebug(14180) << k_funcinfo << " connection is up" << endl; + connected = true; +} + +int main(int argc, char ** argv) +{ + LoginTest a( argc, argv ); + a.exec(); + if ( !a.isConnected() ) + return 0; +} + +#include "logintest.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/tests/logintest.h b/kopete/protocols/yahoo/libkyahoo/tests/logintest.h new file mode 100644 index 00000000..12274843 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/tests/logintest.h @@ -0,0 +1,64 @@ +/* + Kopete Yahoo Protocol + + Copyright (c) 2004 Duncan Mac-Vicar P. <[email protected]> + + Based on code + Copyright (c) 2004 Matt Rogers <[email protected]> + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 logintest_h +#define logintest_h + +#include <qglobal.h> +#include <qapplication.h> +#include <qtimer.h> + +#include "client.h" +#include "coreprotocol.h" +#include "yahooclientstream.h" +#include "yahooconnector.h" + +#include "coreprotocol.h" + +#define QT_FATAL_ASSERT 1 + +class LoginTest : public QApplication +{ +Q_OBJECT +public: + LoginTest(int argc, char ** argv); + + ~LoginTest(); + + bool isConnected() { return connected; } + +public slots: + void slotDoTest(); + + void slotConnected(); + + //void slotWarning(int warning); + + //void slotsend(int layer); + +private: + KNetworkConnector *myConnector; + ClientStream *myClientStream; + Client* myClient; + + bool connected; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/transfer.cpp b/kopete/protocols/yahoo/libkyahoo/transfer.cpp new file mode 100644 index 00000000..cc7f9b0a --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/transfer.cpp @@ -0,0 +1,26 @@ +/* + transfer.cpp - Kopete Groupwise Protocol + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "transfer.h" + +Transfer::Transfer() +{ +} + +Transfer::~Transfer() +{ +} diff --git a/kopete/protocols/yahoo/libkyahoo/transfer.h b/kopete/protocols/yahoo/libkyahoo/transfer.h new file mode 100644 index 00000000..dfa17b21 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/transfer.h @@ -0,0 +1,35 @@ +/* + transfer.h - Kopete Groupwise Protocol + + Copyright (c) 2004 SUSE Linux AG http://www.suse.com + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 TRANSFER_H +#define TRANSFER_H + +/*class Buffer;*/ + +class Transfer +{ +public: + enum TransferType { YMSGTransfer }; + Transfer(); + virtual ~Transfer(); + + virtual TransferType type() = 0; + +}; + +#endif + diff --git a/kopete/protocols/yahoo/libkyahoo/webcamtask.cpp b/kopete/protocols/yahoo/libkyahoo/webcamtask.cpp new file mode 100644 index 00000000..29087440 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/webcamtask.cpp @@ -0,0 +1,689 @@ +/* + Kopete Yahoo Protocol + Handles incoming webcam connections + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "webcamtask.h" +#include "sendnotifytask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <qbuffer.h> +#include <qfile.h> +#include <qtimer.h> +#include <ktempfile.h> +#include <kprocess.h> +#include <kstreamsocket.h> +#include <kdebug.h> +#include <klocale.h> + +using namespace KNetwork; + +WebcamTask::WebcamTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + transmittingData = false; + transmissionPending = false; + timestamp = 1; +} + +WebcamTask::~WebcamTask() +{ +} + +bool WebcamTask::take( Transfer* transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if ( !forMe( transfer ) ) + return false; + + YMSGTransfer *t = static_cast<YMSGTransfer*>(transfer); + + if( t->service() == Yahoo::ServiceWebcam ) + parseWebcamInformation( t ); +// else +// parseMessage( transfer ); + + return true; +} + +bool WebcamTask::forMe( Transfer* transfer ) const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + if ( t->service() == Yahoo::ServiceWebcam ) + return true; + else + return false; +} + +void WebcamTask::requestWebcam( const QString &who ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceWebcam); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit()); + t->setParam( 5, who.local8Bit() ); + keyPending = who; + + send( t ); +} + +void WebcamTask::parseWebcamInformation( YMSGTransfer *t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YahooWebcamInformation info; + info.sender = keyPending; + info.server = t->firstParam( 102 ); + info.key = t->firstParam( 61 ); + info.status = InitialStatus; + info.dataLength = 0; + info.buffer = 0L; + info.headerRead = false; + if( info.sender == client()->userId() ) + { + transmittingData = true; + info.direction = Outgoing; + } + else + info.direction = Incoming; + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Got WebcamInformation: Sender: " << info.sender << " Server: " << info.server << " Key: " << info.key << endl; + + KStreamSocket *socket = new KStreamSocket( info.server, QString::number(5100) ); + socketMap[socket] = info; + socket->enableRead( true ); + connect( socket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( slotConnectionStage1Established() ) ); + connect( socket, SIGNAL( gotError(int) ), this, SLOT( slotConnectionFailed(int) ) ); + connect( socket, SIGNAL( readyRead() ), this, SLOT( slotRead() ) ); + + socket->connect(); +} + +void WebcamTask::slotConnectionStage1Established() +{ + KStreamSocket* socket = const_cast<KStreamSocket*>( dynamic_cast<const KStreamSocket*>( sender() ) ); + if( !socket ) + return; + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Webcam connection Stage1 to the user " << socketMap[socket].sender << " established." << endl; + disconnect( socket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( slotConnectionStage1Established() ) ); + disconnect( socket, SIGNAL( gotError(int) ), this, SLOT( slotConnectionFailed(int) ) ); + socketMap[socket].status = ConnectedStage1; + + + QByteArray buffer; + QDataStream stream( buffer, IO_WriteOnly ); + QString s; + if( socketMap[socket].direction == Incoming ) + { + socket->writeBlock( QCString("<RVWCFG>").data(), 8 ); + s = QString("g=%1\r\n").arg(socketMap[socket].sender); + } + else + { + socket->writeBlock( QCString("<RUPCFG>").data(), 8 ); + s = QString("f=1\r\n"); + } + + // Header: 08 00 01 00 00 00 00 + stream << (Q_INT8)0x08 << (Q_INT8)0x00 << (Q_INT8)0x01 << (Q_INT8)0x00 << (Q_INT32)s.length(); + stream.writeRawBytes( s.local8Bit(), s.length() ); + + socket->writeBlock( buffer.data(), buffer.size() ); +} + +void WebcamTask::slotConnectionStage2Established() +{ + KStreamSocket* socket = const_cast<KStreamSocket*>( dynamic_cast<const KStreamSocket*>( sender() ) ); + if( !socket ) + return; + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Webcam connection Stage2 to the user " << socketMap[socket].sender << " established." << endl; + disconnect( socket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( slotConnectionStage2Established() ) ); + disconnect( socket, SIGNAL( gotError(int) ), this, SLOT( slotConnectionFailed(int) ) ); + socketMap[socket].status = ConnectedStage2; + + QByteArray buffer; + QDataStream stream( buffer, IO_WriteOnly ); + QString s; + + + if( socketMap[socket].direction == Incoming ) + { + // Send <REQIMG>-Packet + socket->writeBlock( QCString("<REQIMG>").data(), 8 ); + // Send request information + s = QString("a=2\r\nc=us\r\ne=21\r\nu=%1\r\nt=%2\r\ni=\r\ng=%3\r\no=w-2-5-1\r\np=1") + .arg(client()->userId()).arg(socketMap[socket].key).arg(socketMap[socket].sender); + // Header: 08 00 01 00 00 00 00 + stream << (Q_INT8)0x08 << (Q_INT8)0x00 << (Q_INT8)0x01 << (Q_INT8)0x00 << (Q_INT32)s.length(); + } + else + { + // Send <REQIMG>-Packet + socket->writeBlock( QCString("<SNDIMG>").data(), 8 ); + // Send request information + s = QString("a=2\r\nc=us\r\nu=%1\r\nt=%2\r\ni=%3\r\no=w-2-5-1\r\np=2\r\nb=KopeteWebcam\r\nd=\r\n") + .arg(client()->userId()).arg(socketMap[socket].key).arg(socket->localAddress().nodeName()); + // Header: 08 00 05 00 00 00 00 01 00 00 00 01 + stream << (Q_INT8)0x0d << (Q_INT8)0x00 << (Q_INT8)0x05 << (Q_INT8)0x00 << (Q_INT32)s.length() + << (Q_INT8)0x01 << (Q_INT8)0x00 << (Q_INT8)0x00 << (Q_INT8)0x00 << (Q_INT8)0x01; + } + socket->writeBlock( buffer.data(), buffer.size() ); + socket->writeBlock( s.local8Bit(), s.length() ); +} + +void WebcamTask::slotConnectionFailed( int error ) +{ + KStreamSocket* socket = const_cast<KStreamSocket*>( dynamic_cast<const KStreamSocket*>( sender() ) ); + client()->notifyError( i18n("Webcam connection to the user %1 could not be established.\n\nPlease relogin and try again.") + .arg(socketMap[socket].sender), QString("%1 - %2").arg(error).arg( socket->errorString()), Client::Error ); + socketMap.remove( socket ); + socket->deleteLater(); +} + +void WebcamTask::slotRead() +{ + KStreamSocket* socket = const_cast<KStreamSocket*>( dynamic_cast<const KStreamSocket*>( sender() ) ); + if( !socket ) + return; + + switch( socketMap[socket].status ) + { + case ConnectedStage1: + disconnect( socket, SIGNAL( readyRead() ), this, SLOT( slotRead() ) ); + connectStage2( socket ); + break; + case ConnectedStage2: + case Sending: + case SendingEmpty: + processData( socket ); + default: + break; + } +} + +void WebcamTask::connectStage2( KStreamSocket *socket ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + QByteArray data( socket->bytesAvailable() ); + socket->readBlock ( data.data (), data.size () ); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Magic Byte:" << data[2] << endl; + + socketMap[socket].status = ConnectedStage2; + + QString server; + int i = 4; + KStreamSocket *newSocket; + switch( (const char)data[2] ) + { + case (Q_INT8)0x06: + emit webcamNotAvailable(socketMap[socket].sender); + break; + case (Q_INT8)0x04: + case (Q_INT8)0x07: + while( (const char)data[i] != (Q_INT8)0x00 ) + server += data[i++]; + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Server:" << server << endl; + if( server.isEmpty() ) + { + emit webcamNotAvailable(socketMap[socket].sender); + break; + } + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Connecting to " << server << endl; + newSocket = new KStreamSocket( server, QString::number(5100) ); + socketMap[newSocket] = socketMap[socket]; + newSocket->enableRead( true ); + connect( newSocket, SIGNAL( connected( const KResolverEntry& ) ), this, SLOT( slotConnectionStage2Established() ) ); + connect( newSocket, SIGNAL( gotError(int) ), this, SLOT( slotConnectionFailed(int) ) ); + connect( newSocket, SIGNAL( readyRead() ), this, SLOT( slotRead() ) ); + if( socketMap[newSocket].direction == Outgoing ) + { + newSocket->enableWrite( true ); + connect( newSocket, SIGNAL( readyWrite() ), this, SLOT( transmitWebcamImage() ) ); + } + + newSocket->connect(); + break; + default: + break; + } + socketMap.remove( socket ); + delete socket; +} + +void WebcamTask::processData( KStreamSocket *socket ) +{ + QByteArray data( socket->bytesAvailable() ); + + socket->readBlock ( data.data (), data.size () ); + if( data.size() <= 0 ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "No data read." << endl; + return; + } + + parseData( data, socket ); +} + +void WebcamTask::parseData( QByteArray &data, KStreamSocket *socket ) +{ + uint headerLength = 0; + uint read = 0; + YahooWebcamInformation *info = &socketMap[socket]; + if( !info->headerRead ) + { + headerLength = data[0]; + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "headerLength " << headerLength << endl; + if( data.size() < headerLength ) + return; + if( headerLength >= 8 ) + { + kdDebug() << data[0] << data[1] << data[2] << data[3] << data[4] << data[5] << data[6] << data[7] << endl; + info->reason = data[1]; + info->dataLength = yahoo_get32(data.data() + 4); + } + if( headerLength == 13 ) + { + kdDebug() << data[8] << data[9] << data[10] << data[11] << data[12] << endl; + info->timestamp = yahoo_get32(data.data() + 9); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "PacketType: " << data[8] << " reason: " << info->reason << " timestamp: " << info->timestamp << endl; + QStringList::iterator it; + switch( data[8] ) + { + case 0x00: + if( info->direction == Incoming ) + { + if( info->timestamp == 0 ) + { + emit webcamClosed( info->sender, 3 ); + cleanUpConnection( socket ); + } + } + else + { + info->type = UserRequest; + info->headerRead = true; + } + break; + case 0x02: + info->type = Image; + info->headerRead = true; + break; + case 0x04: + if( info->timestamp == 1 ) + { + emit webcamPaused( info->sender ); + } + break; + case 0x05: + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Ready for Transmission. " << info->timestamp << " watchers." << endl; + if( info->timestamp == 1 ) + { + info->status = Sending; + emit readyForTransmission(); + } + else if( info->timestamp == 0 ) + { + info->status = SendingEmpty; + emit stopTransmission(); + sendEmptyWebcamImage(); + } + + // Send Invitation packets + for(it = pendingInvitations.begin(); it != pendingInvitations.end(); it++) + { + SendNotifyTask *snt = new SendNotifyTask( parent() ); + snt->setTarget( *it ); + snt->setType( SendNotifyTask::NotifyWebcamInvite ); + snt->go( true ); + it = pendingInvitations.remove( it ); + it--; + } + break; + case 0x07: + + info->type = ConnectionClosed; + emit webcamClosed( info->sender, info->reason ); + cleanUpConnection( socket ); + case 0x0c: + info->type = NewWatcher; + info->headerRead = true; + break; + case 0x0d: + info->type = WatcherLeft; + info->headerRead = true; + break; + } + } + if( headerLength > 13 || headerLength <= 0) //Parse error + return; + if( !info->headerRead && data.size() > headerLength ) + { + // More headers to read + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "More data to read..." << endl; + QByteArray newData( data.size() - headerLength ); + QDataStream stream( newData, IO_WriteOnly ); + stream.writeRawBytes( data.data() + headerLength, data.size() - headerLength ); + parseData( newData, socket ); + return; + } + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Parsed Packet: HeaderLen: " << headerLength << " DataLen: " << info->dataLength << endl; + } + + if( info->dataLength <= 0 ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "No data to read. (info->dataLength <= 0)" << endl; + if( info->headerRead ) + info->headerRead = false; + return; + } + if( headerLength >= data.size() ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "No data to read. (headerLength >= data.size())" << endl; + return; //Nothing to read here... + } + if( !info->buffer ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Buffer created" << endl; + info->buffer = new QBuffer(); + info->buffer->open( IO_WriteOnly ); + } + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "data.size() " << data.size() << " headerLength " << headerLength << " buffersize " << info->buffer->size() << endl; + read = headerLength + info->dataLength - info->buffer->size(); + info->buffer->writeBlock( data.data() + headerLength, data.size() - headerLength );//info->dataLength - info->buffer->size() ); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "read " << data.size() - headerLength << " Bytes, Buffer is now " << info->buffer->size() << endl; + if( info->buffer->size() >= static_cast<uint>(info->dataLength) ) + { + info->buffer->close(); + QString who; + switch( info->type ) + { + case UserRequest: + { + who.append( info->buffer->buffer() ); + who = who.mid( 2, who.find('\n') - 3); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "User wants to view webcam: " << who << " len: " << who.length() << " Index: " << accessGranted.findIndex( who ) << endl; + if( accessGranted.findIndex( who ) >= 0 ) + { + grantAccess( who ); + } + else + emit viewerRequest( who ); + } + break; + case NewWatcher: + who.append( info->buffer->buffer() ); + who = who.left( who.length() - 1 ); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "New Watcher of webcam: " << who << endl; + emit viewerJoined( who ); + break; + case WatcherLeft: + who.append( info->buffer->buffer() ); + who = who.left( who.length() - 1 ); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "A Watcher left: " << who << " len: " << who.length() << endl; + accessGranted.remove( who ); + emit viewerLeft( who ); + break; + case Image: + { + QPixmap webcamImage; + //webcamImage.loadFromData( info->buffer->buffer() ); + + KTempFile jpcTmpImageFile; + KTempFile bmpTmpImageFile; + QFile *file = jpcTmpImageFile.file(); + file->writeBlock((info->buffer->buffer()).data(), info->buffer->size()); + file->close(); + + KProcess p; + p << "jasper"; + p << "--input" << jpcTmpImageFile.name() << "--output" << bmpTmpImageFile.name() << "--output-format" << "bmp"; + + p.start( KProcess::Block ); + if( p.exitStatus() != 0 ) + { + kdDebug(YAHOO_RAW_DEBUG) << " jasper exited with status " << p.exitStatus() << " " << info->sender << endl; + } + else + { + webcamImage.load( bmpTmpImageFile.name() ); + /******* UPTO THIS POINT ******/ + emit webcamImageReceived( info->sender, webcamImage ); + } + QFile::remove(jpcTmpImageFile.name()); + QFile::remove(bmpTmpImageFile.name()); + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Image Received. Size: " << webcamImage.size() << endl; + } + break; + default: + break; + } + + info->headerRead = false; + delete info->buffer; + info->buffer = 0L; + } + if( data.size() > read ) + { + // More headers to read + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "More data to read..." << data.size() - read << endl; + QByteArray newData( data.size() - read ); + QDataStream stream( newData, IO_WriteOnly ); + stream.writeRawBytes( data.data() + read, data.size() - read ); + parseData( newData, socket ); + } +} + +void WebcamTask::cleanUpConnection( KStreamSocket *socket ) +{ + socket->close(); + YahooWebcamInformation *info = &socketMap[socket]; + if( info->buffer ) + delete info->buffer; + socketMap.remove( socket ); + delete socket; +} + +void WebcamTask::closeWebcam( const QString & who ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + SocketInfoMap::Iterator it; + for( it = socketMap.begin(); it != socketMap.end(); it++ ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << it.data().sender << " - " << who << endl; + if( it.data().sender == who ) + { + cleanUpConnection( it.key() ); + return; + } + } + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Error. You tried to close a connection that didn't exist." << endl; + client()->notifyError( i18n( "An error occured closing the webcam session. " ), i18n( "You tried to close a connection that didn't exist." ), Client::Debug ); +} + + +// Sending + +void WebcamTask::registerWebcam() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = new YMSGTransfer(Yahoo::ServiceWebcam); + t->setId( client()->sessionID() ); + t->setParam( 1, client()->userId().local8Bit()); + keyPending = client()->userId(); + + send( t ); +} + +void WebcamTask::addPendingInvitation( const QString &userId ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Inviting " << userId << " to watch the webcam." << endl; + pendingInvitations.append( userId ); + accessGranted.append( userId ); +} + +void WebcamTask::grantAccess( const QString &userId ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + KStreamSocket *socket = 0L; + SocketInfoMap::Iterator it; + for( it = socketMap.begin(); it != socketMap.end(); it++ ) + { + if( it.data().direction == Outgoing ) + { + socket = it.key(); + break; + } + } + if( !socket ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Error. No outgoing socket found." << endl; + return; + } + QByteArray ar; + QDataStream stream( ar, IO_WriteOnly ); + QString user = QString("u=%1").arg(userId); + + stream << (Q_INT8)0x0d << (Q_INT8)0x00 << (Q_INT8)0x05 << (Q_INT8)0x00 << (Q_INT32)user.length() + << (Q_INT8)0x00 << (Q_INT8)0x00 << (Q_INT8)0x00 << (Q_INT8)0x00 << (Q_INT8)0x01; + socket->writeBlock( ar.data(), ar.size() ); + socket->writeBlock( user.local8Bit(), user.length() ); +} + +void WebcamTask::closeOutgoingWebcam() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + KStreamSocket *socket = 0L; + SocketInfoMap::Iterator it; + for( it = socketMap.begin(); it != socketMap.end(); it++ ) + { + if( it.data().direction == Outgoing ) + { + socket = it.key(); + break; + } + } + if( !socket ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Error. No outgoing socket found." << endl; + return; + } + + cleanUpConnection( socket ); + transmittingData = false; +} + +void WebcamTask::sendEmptyWebcamImage() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + KStreamSocket *socket = 0L; + SocketInfoMap::Iterator it; + for( it = socketMap.begin(); it != socketMap.end(); it++ ) + { + if( it.data().direction == Outgoing ) + { + socket = it.key(); + break; + } + } + if( !socket ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Error. No outgoing socket found." << endl; + return; + } + if( socketMap[socket].status != SendingEmpty ) + return; + + pictureBuffer.resize( 0 ); + transmissionPending = true; + + QTimer::singleShot( 1000, this, SLOT(sendEmptyWebcamImage()) ); + +} + +void WebcamTask::sendWebcamImage( const QByteArray &image ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + pictureBuffer.duplicate( image ); + transmissionPending = true; + KStreamSocket *socket = 0L; + SocketInfoMap::Iterator it; + for( it = socketMap.begin(); it != socketMap.end(); it++ ) + { + if( it.data().direction == Outgoing ) + { + socket = it.key(); + break; + } + } + if( !socket ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Error. No outgoing socket found." << endl; + return; + } + + socket->enableWrite( true ); +} + +void WebcamTask::transmitWebcamImage() +{ + if( !transmissionPending ) + return; + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "arraysize: " << pictureBuffer.size() << endl; + + // Find outgoing socket + KStreamSocket *socket = 0L; + SocketInfoMap::Iterator it; + for( it = socketMap.begin(); it != socketMap.end(); it++ ) + { + if( it.data().direction == Outgoing ) + { + socket = it.key(); + break; + } + } + if( !socket ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Error. No outgoing socket found." << endl; + return; + } + + socket->enableWrite( false ); + QByteArray buffer; + QDataStream stream( buffer, IO_WriteOnly ); + stream << (Q_INT8)0x0d << (Q_INT8)0x00 << (Q_INT8)0x05 << (Q_INT8)0x00 << (Q_INT32)pictureBuffer.size() + << (Q_INT8)0x02 << (Q_INT32)timestamp++; + socket->writeBlock( buffer.data(), buffer.size() ); + if( pictureBuffer.size() ) + socket->writeBlock( pictureBuffer.data(), pictureBuffer.size() ); + + transmissionPending = false; +} +#include "webcamtask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/webcamtask.h b/kopete/protocols/yahoo/libkyahoo/webcamtask.h new file mode 100644 index 00000000..71dd2a95 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/webcamtask.h @@ -0,0 +1,112 @@ +/* + Kopete Yahoo Protocol + Handles incoming webcam connections + + Copyright (c) 2005 André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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 WEBCAMTASK_H +#define WEBCAMTASK_H + +#include "task.h" +#include <qmap.h> +#include <qpixmap.h> +#include <qstringlist.h> + +class QString; +class YMSGTransfer; +class QBuffer; +namespace KNetwork { + class KStreamSocket; +} +using namespace KNetwork; + +enum ConnectionStatus{ InitialStatus, ConnectedStage1, ConnectedStage2, Receiving, Sending, SendingEmpty }; +enum PacketType { Image, ConnectionClosed, UserRequest, NewWatcher, WatcherLeft }; +enum Direction { Incoming, Outgoing }; + +struct YahooWebcamInformation +{ + QString sender; + QString server; + QString key; + ConnectionStatus status; + PacketType type; + Direction direction; + uchar reason; + Q_INT32 dataLength; + Q_INT32 timestamp; + bool headerRead; + QBuffer *buffer; +}; + +typedef QMap< KStreamSocket *, YahooWebcamInformation > SocketInfoMap; + +/** +@author André Duffeck +*/ +class WebcamTask : public Task +{ + Q_OBJECT +public: + WebcamTask(Task *parent); + ~WebcamTask(); + + bool take(Transfer *transfer); + bool forMe( Transfer* transfer ) const; + + bool transmitting() { return transmittingData; } + + void requestWebcam( const QString &who ); + void closeWebcam( const QString &who ); + + void registerWebcam(); + void sendWebcamImage( const QByteArray &image ); + void addPendingInvitation( const QString &userId ); + void grantAccess( const QString &userId ); + void closeOutgoingWebcam(); +signals: + void webcamNotAvailable( const QString & ); + void webcamClosed( const QString &, int ); + void webcamPaused( const QString& ); + void webcamImageReceived( const QString &, const QPixmap &); + void readyForTransmission(); + void stopTransmission(); + void viewerJoined( const QString & ); + void viewerLeft( const QString & ); + void viewerRequest( const QString & ); +private slots: + void slotConnectionStage1Established(); + void slotConnectionStage2Established(); + void slotConnectionFailed(int); + void slotRead(); + void sendEmptyWebcamImage(); + void transmitWebcamImage(); +private: + void parseWebcamInformation( YMSGTransfer *transfer ); + void parseData( QByteArray &data, KStreamSocket *socket ); + + void connectStage2( KStreamSocket *socket ); + void processData( KStreamSocket *socket ); + void cleanUpConnection( KStreamSocket *socket ); + + QString keyPending; // the buddy we have requested the webcam from + SocketInfoMap socketMap; + bool transmittingData; + QStringList pendingInvitations; + QStringList accessGranted; + int timestamp; + QByteArray pictureBuffer; + bool transmissionPending; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/yabentry.cpp b/kopete/protocols/yahoo/libkyahoo/yabentry.cpp new file mode 100644 index 00000000..9eab5ef1 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yabentry.cpp @@ -0,0 +1,201 @@ +/* + yabcpp - Encapsulate Yahoo Adressbook information + + Copyright (c) 2005 André Duffeck <[email protected]> + Kopete (c) 2002-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "yabentry.h" + +void YABEntry::fromQDomElement( const QDomElement &e ) +{ + yahooId = e.attribute("yi"); + YABId = e.attribute("id", "-1").toInt(); + firstName = e.attribute("fn"); + secondName = e.attribute("mn"); + lastName = e.attribute("ln"); + nickName = e.attribute("nn"); + email = e.attribute("e0"); + privatePhone = e.attribute("hp"); + workPhone = e.attribute("wp"); + pager = e.attribute("pa"); + fax = e.attribute("fa"); + phoneMobile = e.attribute("mo"); + additionalNumber = e.attribute("ot"); + altEmail1 = e.attribute("e1"); + altEmail2 = e.attribute("e2"); + privateURL = e.attribute("pu"); + title = e.attribute("ti"); + corporation = e.attribute("co"); + workAdress = e.attribute("wa").replace( "
", "\n" ); + workCity = e.attribute("wc"); + workState = e.attribute("ws"); + workZIP = e.attribute("wz"); + workCountry = e.attribute("wn"); + workURL = e.attribute("wu"); + privateAdress = e.attribute("ha").replace( "
", "\n" ); + privateCity = e.attribute("hc"); + privateState = e.attribute("hs"); + privateZIP = e.attribute("hz"); + privateCountry = e.attribute("hn"); + QString birtday = e.attribute("bi"); + birthday = QDate( birtday.section("/",2,2).toInt(), birtday.section("/",1,1).toInt(), birtday.section("/",0,0).toInt() ); + QString an = e.attribute("an"); + anniversary = QDate( an.section("/",2,2).toInt(), an.section("/",1,1).toInt(), an.section("/",0,0).toInt() ); + additional1 = e.attribute("c1"); + additional2 = e.attribute("c2"); + additional3 = e.attribute("c3"); + additional4 = e.attribute("c4"); + notes = e.attribute("cm").replace( "
", "\n" ); + imAIM = e.attribute("ima"); + imGoogleTalk = e.attribute("img"); + imICQ = e.attribute("imq"); + imIRC = e.attribute("imc"); + imMSN = e.attribute("imm"); + imQQ = e.attribute("imqq"); + imSkype = e.attribute("imk"); +} + +void YABEntry::fromQDomDocument( const QDomDocument &d ) +{ + kdDebug() << d.toString() << + d.elementsByTagName("yi").item(0).toElement().text(); + yahooId = d.elementsByTagName("yi").item(0).toElement().text(); + firstName = d.elementsByTagName("fn").item(0).toElement().text(); + secondName = d.elementsByTagName("mn").item(0).toElement().text(); + lastName = d.elementsByTagName("ln").item(0).toElement().text(); + nickName = d.elementsByTagName("nn").item(0).toElement().text(); + email = d.elementsByTagName("e0").item(0).toElement().text(); + privatePhone = d.elementsByTagName("hp").item(0).toElement().text(); + workPhone = d.elementsByTagName("wp").item(0).toElement().text(); + pager = d.elementsByTagName("pa").item(0).toElement().text(); + fax = d.elementsByTagName("fa").item(0).toElement().text(); + phoneMobile = d.elementsByTagName("mo").item(0).toElement().text(); + additionalNumber = d.elementsByTagName("ot").item(0).toElement().text(); + altEmail1 = d.elementsByTagName("e1").item(0).toElement().text(); + altEmail2 = d.elementsByTagName("e2").item(0).toElement().text(); + privateURL = d.elementsByTagName("pu").item(0).toElement().text(); + title = d.elementsByTagName("ti").item(0).toElement().text(); + corporation = d.elementsByTagName("co").item(0).toElement().text(); + workAdress = d.elementsByTagName("wa").item(0).toElement().text().replace( "
", "\n" ); + workCity = d.elementsByTagName("wc").item(0).toElement().text(); + workState = d.elementsByTagName("ws").item(0).toElement().text(); + workZIP = d.elementsByTagName("wz").item(0).toElement().text(); + workCountry = d.elementsByTagName("wn").item(0).toElement().text(); + workURL = d.elementsByTagName("wu").item(0).toElement().text(); + privateAdress = d.elementsByTagName("ha").item(0).toElement().text().replace( "
", "\n" ); + privateCity = d.elementsByTagName("hc").item(0).toElement().text(); + privateState = d.elementsByTagName("hs").item(0).toElement().text(); + privateZIP = d.elementsByTagName("hz").item(0).toElement().text(); + privateCountry = d.elementsByTagName("hn").item(0).toElement().text(); + QString birtday = d.elementsByTagName("bi").item(0).toElement().text(); + birthday = QDate( birtday.section("/",2,2).toInt(), birtday.section("/",1,1).toInt(), birtday.section("/",0,0).toInt() ); + QString an = d.elementsByTagName("an").item(0).toElement().text(); + anniversary = QDate( an.section("/",2,2).toInt(), an.section("/",1,1).toInt(), an.section("/",0,0).toInt() ); + additional1 = d.elementsByTagName("c1").item(0).toElement().text(); + additional2 = d.elementsByTagName("c2").item(0).toElement().text(); + additional3 = d.elementsByTagName("c3").item(0).toElement().text(); + additional4 = d.elementsByTagName("c4").item(0).toElement().text(); + notes = d.elementsByTagName("cm").item(0).toElement().text().replace( "
", "\n" ); + imAIM = d.elementsByTagName("ima").item(0).toElement().text(); + imGoogleTalk = d.elementsByTagName("img").item(0).toElement().text(); + imICQ = d.elementsByTagName("imq").item(0).toElement().text(); + imIRC = d.elementsByTagName("imc").item(0).toElement().text(); + imMSN = d.elementsByTagName("imm").item(0).toElement().text(); + imQQ = d.elementsByTagName("imqq").item(0).toElement().text(); + imSkype = d.elementsByTagName("imk").item(0).toElement().text(); +} + +void YABEntry::fillQDomElement( QDomElement &e ) const +{ + e.setAttribute( "yi", yahooId ); + e.setAttribute( "id", YABId ); + e.setAttribute( "fn", firstName ); + e.setAttribute( "mn", secondName ); + e.setAttribute( "ln", lastName ); + e.setAttribute( "nn", nickName ); + e.setAttribute( "e0", email ); + e.setAttribute( "hp", privatePhone ); + e.setAttribute( "wp", workPhone ); + e.setAttribute( "pa", pager ); + e.setAttribute( "fa", fax ); + e.setAttribute( "mo", phoneMobile ); + e.setAttribute( "ot", additionalNumber ); + e.setAttribute( "e1", altEmail1 ); + e.setAttribute( "e2", altEmail2 ); + e.setAttribute( "pu", privateURL ); + e.setAttribute( "ti", title ); + e.setAttribute( "co", corporation ); + e.setAttribute( "wa", QString( workAdress ).replace( "\n", "
" ) ); + e.setAttribute( "wc", workCity ); + e.setAttribute( "ws", workState ); + e.setAttribute( "wz", workZIP ); + e.setAttribute( "wn", workCountry ); + e.setAttribute( "wu", workURL ); + e.setAttribute( "ha", QString( privateAdress ).replace( "\n", "
" ) ); + e.setAttribute( "hc", privateCity ); + e.setAttribute( "hs", privateState ); + e.setAttribute( "hz", privateZIP ); + e.setAttribute( "hn", privateCountry ); + e.setAttribute( "bi", QString("%1/%2/%3").arg( birthday.day() ).arg( birthday.month() ).arg( birthday.year() ) ); + e.setAttribute( "an", QString("%1/%2/%3").arg( anniversary.day() ).arg( anniversary.month() ).arg( anniversary.year() ) ); + e.setAttribute( "c1", additional1 ); + e.setAttribute( "c2", additional2 ); + e.setAttribute( "c3", additional3 ); + e.setAttribute( "c4", additional4 ); + e.setAttribute( "cm", QString( notes ).replace( "\n", "
" ) ); + e.setAttribute( "ima", imAIM ); + e.setAttribute( "img", imGoogleTalk ); + e.setAttribute( "imq", imICQ ); + e.setAttribute( "imc", imIRC ); + e.setAttribute( "imm", imMSN ); + e.setAttribute( "imqq", imQQ ); + e.setAttribute( "imk", imSkype ); +} + +void YABEntry::dump() const +{ + kdDebug() << "firstName: " << firstName << endl << + "secondName: " << secondName << endl << + "lastName: " << lastName << endl << + "nickName: " << nickName << endl << + "title: " << title << endl << + "phoneMobile: " << phoneMobile << endl << + "email: " << email << endl << + "yahooId: " << yahooId << endl << + "pager: " << pager << endl << + "fax: " << fax << endl << + "additionalNumber: " << additionalNumber << endl << + "altEmail1: " << altEmail1 << endl << + "altEmail2: " << altEmail2 << endl << + "privateAdress: " << privateAdress << endl << + "privateCity: " << privateCity << endl << + "privateState: " << privateState << endl << + "privateZIP: " << privateZIP << endl << + "privateCountry: " << privateCountry << endl << + "privatePhone: " << privatePhone << endl << + "privateURL: " << privateURL << endl << + "corporation: " << corporation << endl << + "workAdress: " << workAdress << endl << + "workCity: " << workCity << endl << + "workState: " << workState << endl << + "workZIP: " << workZIP << endl << + "workCountry: " << workCountry << endl << + "workURL: " << workURL << endl << + "birthday: " << birthday.toString() << endl << + "anniversary: " << anniversary.toString() << endl << + "notes: " << notes << endl << + "additional1: " << additional1 << endl << + "additional2: " << additional2 << endl << + "additional3: " << additional3 << endl << + "additional4: " << additional4 << endl; +} diff --git a/kopete/protocols/yahoo/libkyahoo/yabentry.h b/kopete/protocols/yahoo/libkyahoo/yabentry.h new file mode 100644 index 00000000..b12845ce --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yabentry.h @@ -0,0 +1,91 @@ +/* + yabentry.h - Encapsulate Yahoo Adressbook information + + Copyright (c) 2005 André Duffeck <[email protected]> + Kopete (c) 2002-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 YABEntry_H +#define YABEntry_H + +#include <kdebug.h> +#include <qdatetime.h> +#include <qdom.h> + +struct YABEntry +{ + enum Source { SourceYAB, SourceContact }; + + // Personal + QString firstName; + QString secondName; + QString lastName; + QString nickName; + QString title; + + // Primary Information + QString phoneMobile; + QString email; + QString yahooId; + int YABId; + Source source; + + // Additional Information + QString pager; + QString fax; + QString additionalNumber; + QString altEmail1; + QString altEmail2; + QString imAIM; + QString imICQ; + QString imMSN; + QString imGoogleTalk; + QString imSkype; + QString imIRC; + QString imQQ; + + // Private Information + QString privateAdress; + QString privateCity; + QString privateState; + QString privateZIP; + QString privateCountry; + QString privatePhone; + QString privateURL; + + // Work Information + QString corporation; + QString workAdress; + QString workCity; + QString workState; + QString workZIP; + QString workCountry; + QString workPhone; + QString workURL; + + // Miscellanous + QDate birthday; + QDate anniversary; + QString notes; + QString additional1; + QString additional2; + QString additional3; + QString additional4; + + + void fromQDomElement( const QDomElement &e ); + void fromQDomDocument( const QDomDocument &e ); + void fillQDomElement( QDomElement &e ) const; + + void dump() const; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/yabtask.cpp b/kopete/protocols/yahoo/libkyahoo/yabtask.cpp new file mode 100644 index 00000000..38aea9ca --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yabtask.cpp @@ -0,0 +1,160 @@ +/* + Kopete Yahoo Protocol + yabtask.h - Handles the Yahoo Address Book + + Copyright (c) 2006 André Duffeck <[email protected]> + Kopete (c) 2002-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "yabtask.h" +#include "transfer.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "client.h" +#include <qstring.h> +#include <qdatastream.h> +#include <kio/global.h> +#include <kio/job.h> +#include <kio/jobclasses.h> +#include <klocale.h> + +YABTask::YABTask(Task* parent) : Task(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +} + +YABTask::~YABTask() +{ +} + +bool YABTask::take( Transfer* transfer ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + if ( !forMe( transfer ) ) + return false; + + YMSGTransfer *t = static_cast<YMSGTransfer*>(transfer); + + if( t->service() == Yahoo::ServiceContactDetails ) + parseContactDetails( t ); + + return true; +} + +bool YABTask::forMe( Transfer* transfer ) const +{ +// kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + YMSGTransfer *t = 0L; + t = dynamic_cast<YMSGTransfer*>(transfer); + if (!t) + return false; + + if ( t->service() == Yahoo::ServiceContactDetails ) + return true; + else + return false; +} + +void YABTask::parseContactDetails( YMSGTransfer* t ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + QString from; /* key = 7 */ + int count; + + from = t->firstParam( 4 ); + count = t->paramCount( 5 ); + + for( int i = 0; i < count; i++ ) + { + QString who = t->nthParam( 5, i ); + QString s = t->nthParamSeparated( 280, i, 5 ); + if( s.isEmpty() ) + continue; + + QDomDocument doc; + doc.setContent( s ); + YABEntry *entry = new YABEntry; + entry->fromQDomDocument( doc ); + entry->source = YABEntry::SourceContact; + entry->dump(); + emit gotEntry( entry ); + } +} + + +void YABTask::getAllEntries( long lastMerge, long lastRemoteRevision ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "LastMerge: " << lastMerge << " LastRemoteRevision: " << lastRemoteRevision << endl; + m_data = QString::null; + QString url = QString::fromLatin1("http://address.yahoo.com/yab/us?v=XM&prog=ymsgr&.intl=us&diffs=1&t=%1&tags=short&rt=%2&prog-ver=%3") + .arg( lastMerge ).arg( lastRemoteRevision ).arg( YMSG_PROGRAM_VERSION_STRING ); + + m_transferJob = KIO::get( url , false, false ); + m_transferJob->addMetaData("cookies", "manual"); + m_transferJob->addMetaData("setcookies", QString::fromLatin1("Cookie: Y=%1; T=%2; C=%3;") + .arg(client()->yCookie()).arg(client()->tCookie()).arg(client()->cCookie()) ); + connect( m_transferJob, SIGNAL( data( KIO::Job *, const QByteArray & ) ), this, SLOT( slotData( KIO::Job*, const QByteArray & ) ) ); + connect( m_transferJob, SIGNAL( result( KIO::Job *) ), this, SLOT( slotResult( KIO::Job* ) ) ); +} + +void YABTask::slotData( KIO::Job* /*job*/, const QByteArray &info ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + m_data += info; +} + +void YABTask::slotResult( KIO::Job* job ) +{ + if( job->error () || m_transferJob->isErrorPage () ) + client()->notifyError( i18n( "Could not retrieve server side addressbook for user info." ), job->errorString(), Client::Info ); + else + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Server side addressbook retrieved." << endl; + QDomDocument doc; + QDomNodeList list; + QDomElement e; + uint it = 0; + + kdDebug(YAHOO_RAW_DEBUG) << m_data << endl; + doc.setContent( m_data ); + + list = doc.elementsByTagName( "ab" ); // Get the Addressbook + for( it = 0; it < list.count(); it++ ) { + if( !list.item( it ).isElement() ) + continue; + e = list.item( it ).toElement(); + + if( !e.attribute( "lm" ).isEmpty() ) + emit gotRevision( e.attribute( "lm" ).toLong(), true ); + + if( !e.attribute( "rt" ).isEmpty() ) + emit gotRevision( e.attribute( "rt" ).toLong(), false ); + } + + list = doc.elementsByTagName( "ct" ); // Get records + for( it = 0; it < list.count(); it++ ) { + if( !list.item( it ).isElement() ) + continue; + e = list.item( it ).toElement(); + + YABEntry *entry = new YABEntry; + entry->fromQDomElement( e ); + entry->source = YABEntry::SourceYAB; + emit gotEntry( entry ); + } + } +} + +#include "yabtask.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/yabtask.h b/kopete/protocols/yahoo/libkyahoo/yabtask.h new file mode 100644 index 00000000..bd22ead7 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yabtask.h @@ -0,0 +1,60 @@ +/* + Kopete Yahoo Protocol + yabtask.h - Handles the Yahoo Address Book + + Copyright (c) 2006 André Duffeck <[email protected]> + Kopete (c) 2002-2006 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 YABTASK_H +#define YABTASK_H + +#include "task.h" +#include "yabentry.h" + +class YMSGTransfer; +struct KURL; +namespace KIO { + class Job; + class TransferJob; +} +class QDomElement; + +/** +@author André Duffeck +*/ +class YABTask : public Task +{ + Q_OBJECT +public: + YABTask(Task *parent); + ~YABTask(); + + bool take(Transfer *transfer); + bool forMe( Transfer* transfer ) const; + + void getAllEntries( long lastMerge, long lastRemoteRevision ); + void saveEntry( const YABEntry & ); +signals: + void gotEntry( YABEntry * ); + void gotRevision( long rev, bool merged ); +protected: + void parseContactDetails( YMSGTransfer* t ); +private slots: + void slotData( KIO::Job*, const QByteArray & ); + void slotResult( KIO::Job* ); +private: + KIO::TransferJob *m_transferJob; + QString m_data; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/yahoo_fn.c b/kopete/protocols/yahoo/libkyahoo/yahoo_fn.c new file mode 100644 index 00000000..dec93561 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yahoo_fn.c @@ -0,0 +1,4620 @@ +/* + * gaim + * + * Some code copyright (C) 1998-1999, Mark Spencer <[email protected]> + * libfaim code copyright 1998, 1999 Adam Fritzler <[email protected]> + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "yahoo_fn.h" + +unsigned char table_0[256] = { + 0x5A, 0x41, 0x11, 0x77, 0x29, 0x9C, 0x31, 0xAD, + 0x4A, 0x32, 0x1A, 0x6D, 0x56, 0x9F, 0x39, 0xA6, + 0x0C, 0xE8, 0x49, 0x40, 0xA4, 0x21, 0xE9, 0x01, + 0x91, 0x86, 0x2F, 0xB9, 0xED, 0x80, 0x51, 0xAB, + 0x7F, 0x92, 0xF2, 0x73, 0xCD, 0xD9, 0x75, 0x2A, + 0x70, 0x34, 0x35, 0x8D, 0xA8, 0x72, 0x7D, 0x9B, + 0x2E, 0xC5, 0x2D, 0x76, 0x1E, 0xBB, 0xE7, 0x37, + 0xBA, 0xB7, 0xB2, 0x03, 0x20, 0x17, 0x8A, 0x07, + 0xD6, 0x96, 0x13, 0x95, 0xE5, 0xF1, 0x18, 0x3B, + 0xA5, 0x62, 0x33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 0x82, 0x63, 0x47, 0x23 }; + +unsigned char table_1[256] = { + 0x08, 0xCB, 0x54, 0xCF, 0x97, 0x53, 0x59, 0xF1, + 0x66, 0xEC, 0xDB, 0x1B, 0xB1, 0xE2, 0x36, 0xEB, + 0xB3, 0x8F, 0x71, 0xA8, 0x90, 0x7D, 0xDA, 0xDC, + 0x2C, 0x2F, 0xE8, 0x6A, 0x73, 0x37, 0xAE, 0xCC, + 0xA1, 0x16, 0xE6, 0xFC, 0x9C, 0xA9, 0x2A, 0x3F, + 0x58, 0xFD, 0x56, 0x4C, 0xA5, 0xF2, 0x33, 0x99, + 0x1A, 0xB7, 0xFE, 0xA6, 0x1E, 0x32, 0x9E, 0x48, + 0x03, 0x4A, 0x78, 0xEE, 0xCA, 0xC3, 0x88, 0x7A, + 0xAC, 0x23, 0xAA, 0xBD, 0xDE, 0xD3, 0x67, 0x43, + 0xFF, 0x64, 0x8A, 0xF9, 0x04, 0xD0, 0x7B, 0xC2, + 0xBC, 0xF3, 0x89, 0x0E, 0xDD, 0xAB, 0x9D, 0x84, + 0x5A, 0x62, 0x7F, 0x6D, 0x82, 0x68, 0xA3, 0xED, + 0x2E, 0x07, 0x41, 0xEF, 0x2D, 0x70, 0x4F, 0x69, + 0x8E, 0xE7, 0x0F, 0x11, 0x19, 0xAF, 0x31, 0xFB, + 0x8D, 0x4B, 0x5F, 0x96, 0x75, 0x42, 0x6C, 0x46, + 0xE4, 0x55, 0xD6, 0x3B, 0xE1, 0xD1, 0xB0, 0xB5, + 0x45, 0x29, 0xC0, 0x94, 0x9F, 0xD4, 0x15, 0x17, + 0x3C, 0x47, 0xC8, 0xD9, 0xC6, 0x76, 0xB9, 0x02, + 0xE0, 0xC9, 0xB2, 0x01, 0xC1, 0x5D, 0x4E, 0x14, + 0xF4, 0xAD, 0xB6, 0x00, 0x72, 0xF0, 0x49, 0x0D, + 0xD8, 0x5E, 0x6F, 0x2B, 0x8C, 0x51, 0x83, 0xC5, + 0x0A, 0x85, 0xE5, 0x38, 0x7E, 0x26, 0xEA, 0x22, + 0x6B, 0x06, 0xD5, 0x8B, 0xBF, 0xC7, 0x35, 0x1D, + 0xF6, 0x24, 0x28, 0xCE, 0x9B, 0x77, 0x20, 0x60, + 0xF5, 0x87, 0x3D, 0x65, 0x86, 0x0C, 0xDF, 0xBA, + 0x12, 0xA4, 0x3A, 0x34, 0xD7, 0xA0, 0xF8, 0x63, + 0x52, 0x27, 0xB8, 0x18, 0xA7, 0x13, 0x91, 0x09, + 0x93, 0x5C, 0x10, 0x9A, 0xB4, 0xE9, 0x44, 0xC4, + 0x21, 0x57, 0x1C, 0x0B, 0xA2, 0x74, 0x4D, 0xBE, + 0xD2, 0x1F, 0xCD, 0xE3, 0x6E, 0x7C, 0x40, 0x50, + 0x39, 0x80, 0x98, 0xFA, 0x25, 0x92, 0x30, 0x5B, + 0x05, 0x95, 0xBB, 0x79, 0x61, 0x3E, 0x81, 0xF7 }; + +unsigned char table_2[32] = { + 0x19, 0x05, 0x09, 0x1C, 0x0B, 0x1A, 0x12, 0x03, + 0x06, 0x04, 0x0D, 0x1D, 0x15, 0x0E, 0x1B, 0x18, + 0x00, 0x07, 0x08, 0x02, 0x13, 0x1F, 0x0C, 0x1E, + 0x16, 0x0A, 0x10, 0x0F, 0x01, 0x14, 0x11, 0x17 }; + +unsigned char table_3[256] = { + 0xBC, 0x1B, 0xCC, 0x1E, 0x5B, 0x59, 0x4F, 0xA8, + 0x62, 0xC6, 0xC1, 0xBB, 0x83, 0x2D, 0xA3, 0xA6, + 0x5A, 0xDC, 0xE5, 0x93, 0xFB, 0x5C, 0xD6, 0x2A, + 0x97, 0xC7, 0x1C, 0x73, 0x08, 0x45, 0xD2, 0x89, + 0x4A, 0xD4, 0xCF, 0x0C, 0x1D, 0xD8, 0xCD, 0x26, + 0x8F, 0x11, 0x55, 0x8B, 0xD3, 0x53, 0xCE, 0x00, + 0xB5, 0x3B, 0x2E, 0x39, 0x88, 0x7B, 0x85, 0x46, + 0x54, 0x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0xFA, 0x20, 0xB6, + 0xEA, 0x49, 0x23, 0x4D, 0xB3, 0x8E, 0xC3, 0x1F, + 0x7C, 0xEF, 0xE0, 0x99, 0x09, 0xA0, 0x01, 0x7E }; + +unsigned char table_4[32] = { + 0x1F, 0x0B, 0x00, 0x1E, 0x03, 0x0E, 0x15, 0x01, + 0x1A, 0x17, 0x1D, 0x1B, 0x11, 0x0F, 0x0A, 0x12, + 0x13, 0x18, 0x02, 0x04, 0x09, 0x06, 0x0D, 0x07, + 0x08, 0x05, 0x10, 0x19, 0x0C, 0x14, 0x16, 0x1C }; + +unsigned char table_5[256] = { + 0x9A, 0xAB, 0x61, 0x28, 0x0A, 0x23, 0xFC, 0xBA, + 0x90, 0x22, 0xB7, 0x62, 0xD9, 0x09, 0x91, 0xF4, + 0x7B, 0x5D, 0x6B, 0x80, 0xAC, 0x9E, 0x21, 0x72, + 0x64, 0x2D, 0xFF, 0x66, 0xEB, 0x5B, 0x05, 0xC8, + 0x1B, 0xD1, 0x55, 0xF5, 0x97, 0x08, 0xAE, 0xC7, + 0x00, 0xDE, 0xE1, 0x78, 0xD8, 0xB6, 0xF0, 0x17, + 0xE4, 0x32, 0xCD, 0x76, 0x07, 0x14, 0x7F, 0x7A, + 0xBF, 0xB4, 0x1D, 0x94, 0x48, 0x75, 0xFA, 0xA7, + 0x99, 0x7E, 0x65, 0x38, 0x29, 0x51, 0xC3, 0x83, + 0x7C, 0x0D, 0xA0, 0xCC, 0xF1, 0xDD, 0xE2, 0x49, + 0xF8, 0xD2, 0x25, 0x54, 0x9B, 0x0E, 0xB9, 0xFE, + 0x67, 0xC4, 0xCE, 0x13, 0xD4, 0xE7, 0xB8, 0x41, + 0x77, 0xDB, 0xA6, 0xB0, 0x11, 0x6A, 0x5E, 0x68, + 0x8D, 0xF9, 0x36, 0xD3, 0xC2, 0x3A, 0xAA, 0x59, + 0x03, 0xE0, 0xE3, 0xF3, 0x42, 0x2C, 0x04, 0x47, + 0xE6, 0x93, 0xCB, 0x6E, 0x20, 0xCA, 0x01, 0xA1, + 0x40, 0x2B, 0x2F, 0x5F, 0x87, 0xD0, 0xEC, 0x88, + 0x27, 0x58, 0xC6, 0x3E, 0xDF, 0x26, 0x5C, 0xE9, + 0x1F, 0x0F, 0x95, 0x1C, 0xFB, 0xA5, 0x12, 0x39, + 0x1E, 0x3C, 0x33, 0x43, 0x56, 0xE8, 0x82, 0xF7, + 0x7D, 0x89, 0xF2, 0xD7, 0x50, 0x92, 0x60, 0x4C, + 0x2A, 0x86, 0x16, 0x6C, 0x37, 0xC0, 0xAD, 0xB3, + 0x24, 0x45, 0xB1, 0xA2, 0x71, 0xA4, 0xA3, 0xED, + 0xC9, 0x5A, 0x4D, 0x84, 0x0C, 0x3F, 0xC5, 0x9D, + 0x63, 0x19, 0x79, 0x57, 0x96, 0x30, 0x74, 0xBB, + 0xDA, 0x1A, 0x9F, 0x44, 0xC1, 0x98, 0xE5, 0x81, + 0xD6, 0x18, 0x8F, 0xFD, 0x8E, 0x06, 0x6F, 0xF6, + 0x2E, 0x3B, 0xB5, 0x85, 0x8A, 0x9C, 0x53, 0x4A, + 0xA9, 0x52, 0x3D, 0x4E, 0xBE, 0xAF, 0xBC, 0xA8, + 0x4F, 0x6D, 0x15, 0x35, 0x8C, 0xBD, 0x34, 0x8B, + 0xDC, 0x0B, 0xCF, 0x31, 0xEA, 0xB2, 0x70, 0x4B, + 0x46, 0x73, 0x69, 0xD5, 0x10, 0xEE, 0x02, 0xEF }; + +unsigned char table_6[32] = { + 0x1A, 0x1C, 0x0F, 0x0C, 0x00, 0x02, 0x13, 0x09, + 0x11, 0x05, 0x0D, 0x12, 0x18, 0x0B, 0x04, 0x10, + 0x14, 0x1B, 0x1E, 0x16, 0x07, 0x08, 0x03, 0x17, + 0x19, 0x1F, 0x01, 0x0E, 0x15, 0x06, 0x0A, 0x1D }; + +unsigned char table_7[256] = { + 0x52, 0x11, 0x72, 0xD0, 0x76, 0xD7, 0xAE, 0x03, + 0x7F, 0x19,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, 0x63, 0x48, 0xED, 0xBA, + 0xCF, 0xBB, 0x1F, 0xDC, 0xA4, 0xFA, 0x64, 0x75, + 0xDE, 0x81, 0x9A, 0xFF, 0x49, 0x41, 0x27, 0x62, + 0x02, 0x15, 0xD9, 0x86, 0xAC, 0x3F, 0x0C, 0x61, + 0xD1, 0x77, 0x2B, 0x1B, 0x96, 0xDA, 0x68, 0x1C, + 0x44, 0x32, 0xBC, 0xA2, 0x87, 0xF7, 0x91, 0x8D, + 0x80, 0xDD, 0x0A, 0x50, 0x34, 0x4B, 0x00, 0xB9, + 0x36, 0xE6, 0x78, 0x4F, 0xC9, 0xE9, 0x2C, 0x43, + 0x88, 0x9E, 0x9C, 0x5B, 0x4D, 0x3A, 0x39, 0xEF }; + +unsigned char table_8[32] = { + 0x13, 0x08, 0x1E, 0x1D, 0x17, 0x16, 0x07, 0x1F, + 0x0E, 0x03, 0x1A, 0x19, 0x01, 0x12, 0x11, 0x10, + 0x09, 0x0C, 0x0F, 0x14, 0x0B, 0x05, 0x00, 0x04, + 0x1C, 0x18, 0x0A, 0x15, 0x02, 0x1B, 0x06, 0x0D }; + +unsigned char table_9[256] = { + 0x20, 0x2A, 0xDA, 0xFE, 0x76, 0x0D, 0xED, 0x39, + 0x51, 0x4C, 0x46, 0x9A, 0xF1, 0xB0, 0x10, 0xC7, + 0xD1, 0x6F, 0x18, 0x24, 0xB9, 0x7A, 0x4F, 0x47, + 0xE0, 0x4E, 0x88, 0x09, 0x8A, 0xBA, 0x60, 0xBD, + 0xC2, 0x27, 0x93, 0x7D, 0x94, 0x40, 0xCB, 0x80, + 0xB8, 0x41, 0x84, 0x5D, 0xC1, 0x0F, 0x5E, 0x78, + 0x2B, 0x48, 0x28, 0x29, 0xEE, 0x81, 0x90, 0x86, + 0x50, 0x9C, 0xF3, 0xB2, 0x35, 0x52, 0x0C, 0x9D, + 0xFC, 0x69, 0xD6, 0xA6, 0x06, 0xD7, 0xC6, 0xFF, + 0x1C, 0x14, 0x57, 0x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71, 0xC0, 0x2D }; + +unsigned char table_10[32] = { + 0x1D, 0x12, 0x11, 0x0D, 0x1E, 0x19, 0x16, 0x1B, + 0x18, 0x13, 0x07, 0x17, 0x0C, 0x02, 0x00, 0x15, + 0x0E, 0x08, 0x05, 0x01, 0x10, 0x06, 0x04, 0x0F, + 0x1F, 0x1A, 0x0B, 0x09, 0x0A, 0x14, 0x1C, 0x03 }; + +unsigned char table_11[256] = { + 0x6B, 0x1D, 0xC6, 0x0A, 0xB7, 0xAC, 0xB2, 0x11, + 0x29, 0xD3, 0xA2, 0x4D, 0xCB, 0x03, 0xEF, 0xA6, + 0xC1, 0x5D, 0x75, 0x48, 0x35, 0x6C, 0xE2, 0x84, + 0xAB, 0xAA, 0xD8, 0x2C, 0x0E, 0x95, 0x25, 0x27, + 0x7D, 0x0B, 0xD0, 0xFB, 0x14, 0xE5, 0xF2, 0x4E, + 0x7F, 0x2A, 0x63, 0x3C, 0xC9, 0xF6, 0xDC, 0x07, + 0x26, 0x55, 0xCF, 0x2B, 0xCD, 0xA7, 0x17, 0xD2, + 0x9A, 0x7B, 0x93, 0x78, 0x9E, 0xE6, 0x2F, 0x49, + 0x1E, 0xFD, 0xF0, 0xFE, 0x7C, 0x33, 0x92, 0xA3, + 0xC8, 0xA0, 0xA9, 0xC4, 0xA1, 0x94, 0x6D, 0x44, + 0x0C, 0x90, 0x3A, 0x8C, 0x8E, 0x85, 0xAF, 0x40, + 0x36, 0xA4, 0xD1, 0xB9, 0x19, 0x6F, 0xF4, 0xBA, + 0x1A, 0x73, 0xD9, 0xB5, 0xB4, 0x7A, 0xF9, 0x83, + 0x58, 0xAD, 0xCE, 0x60, 0x98, 0xDB, 0x1C, 0x1B, + 0x52, 0xB8, 0xF3, 0x96, 0xED, 0xDE, 0xB3, 0xEE, + 0x4F, 0xBD, 0x10, 0xD4, 0x43, 0xEA, 0xE7, 0x37, + 0x12, 0x3D, 0xA8, 0x22, 0x65, 0xEC, 0x5B, 0x08, + 0x9D, 0x0D, 0x5C, 0xB6, 0x8A, 0x79, 0x3F, 0x04, + 0xD6, 0x01, 0xE1, 0xBE, 0xDD, 0x50, 0xFA, 0x41, + 0x13, 0x91, 0xF7, 0xDA, 0x18, 0xB0, 0x45, 0x81, + 0x4C, 0xF5, 0x32, 0x23, 0x56, 0x5A, 0xEB, 0x97, + 0x34, 0x00, 0x77, 0x71, 0x4B, 0x70, 0xD5, 0x31, + 0x72, 0x05, 0xDF, 0xE8, 0x15, 0x3B, 0x54, 0x16, + 0x89, 0xE4, 0xF1, 0xD7, 0x80, 0x82, 0x4A, 0xE3, + 0x39, 0x06, 0x47, 0x28, 0xC2, 0x86, 0x87, 0xB1, + 0x62, 0x74, 0x53, 0x21, 0x67, 0x38, 0x42, 0xCA, + 0x9B, 0xC3, 0x51, 0x99, 0x8B, 0x1F, 0x24, 0x8D, + 0xF8, 0x68, 0x3E, 0x59, 0xBB, 0x61, 0x5F, 0xBC, + 0x09, 0x6E, 0x8F, 0x0F, 0x2D, 0xC0, 0xE0, 0x46, + 0x66, 0x69, 0xA5, 0xE9, 0x30, 0x9C, 0x5E, 0xAE, + 0xBF, 0xC7, 0x20, 0x7E, 0x6A, 0xC5, 0x88, 0xFC, + 0x64, 0x76, 0xFF, 0x9F, 0x2E, 0x02, 0xCC, 0x57 }; + +unsigned char table_12[32] = { + 0x14, 0x1B, 0x18, 0x00, 0x1F, 0x15, 0x17, 0x07, + 0x11, 0x1A, 0x0E, 0x13, 0x12, 0x06, 0x01, 0x03, + 0x1C, 0x0C, 0x0B, 0x1D, 0x10, 0x0F, 0x09, 0x19, + 0x0D, 0x1E, 0x04, 0x05, 0x08, 0x16, 0x0A, 0x02 }; + +unsigned char table_13[256] = { + 0x37, 0x8A, 0x1B, 0x91, 0xA5, 0x2B, 0x2D, 0x88, + 0x8E, 0xFE, 0x0E, 0xD3, 0xF3, 0xE9, 0x7D, 0xD1, + 0x24, 0xEA, 0xB1, 0x8B, 0x5C, 0xA4, 0x44, 0x7E, + 0x8C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, 0xA2, 0x90, 0x13, 0x25, + 0x01, 0x08, 0x64, 0xB6, 0x02, 0xDB, 0x55, 0x32, + 0xAF, 0x9A, 0xC0, 0x1C, 0x12, 0x29, 0x0B, 0x72, + 0x4F, 0xDA, 0xAB, 0x35, 0xF8, 0x22, 0xD9, 0x4E, + 0x3D, 0x1E, 0xDC, 0x58, 0x20, 0x34, 0xAE, 0x66, + 0x75, 0x93, 0x9F, 0x3A, 0x07, 0xE5, 0x89, 0xDF, + 0x97, 0x4A, 0xB8, 0x7A, 0xF4, 0xFB, 0x04, 0xA8 }; + +unsigned char table_14[32] = { + 0x04, 0x14, 0x13, 0x15, 0x1A, 0x1B, 0x0F, 0x16, + 0x02, 0x0D, 0x0C, 0x06, 0x10, 0x17, 0x01, 0x0B, + 0x1E, 0x08, 0x1C, 0x18, 0x19, 0x0A, 0x1F, 0x05, + 0x11, 0x09, 0x1D, 0x07, 0x0E, 0x12, 0x03, 0x00 }; + +unsigned char table_15[256] = { + 0x61, 0x48, 0x58, 0x41, 0x7F, 0x88, 0x43, 0x42, + 0xD9, 0x80, 0x81, 0xFE, 0xC6, 0x49, 0xD7, 0x2C, + 0xE6, 0x5B, 0xEE, 0xFF, 0x2A, 0x6F, 0xBF, 0x98, + 0xD6, 0x20, 0xB9, 0xB1, 0x5D, 0x95, 0x72, 0x1E, + 0x82, 0x96, 0xDE, 0xC1, 0x40, 0xD8, 0x70, 0xA3, + 0xD1, 0x1F, 0xF0, 0x9F, 0x2D, 0xDC, 0x3F, 0xF9, + 0x5E, 0x0D, 0x15, 0x2F, 0x67, 0x31, 0x9D, 0x84, + 0x97, 0x0C, 0xF6, 0x79, 0xC2, 0xA7, 0xC0, 0x32, + 0xB3, 0xEB, 0xED, 0x71, 0x30, 0xCC, 0x4B, 0xA0, + 0xF5, 0xC4, 0xCD, 0x27, 0xFA, 0x11, 0x25, 0xDB, + 0x4F, 0xE2, 0x7E, 0xA6, 0xAF, 0x34, 0x69, 0x63, + 0x8F, 0x08, 0x1C, 0x85, 0xF1, 0x57, 0x78, 0xC8, + 0xA2, 0x83, 0xB5, 0x68, 0xF7, 0x64, 0x45, 0x26, + 0x3B, 0x03, 0xAD, 0x3C, 0x50, 0xD5, 0x77, 0xFC, + 0xFB, 0x18, 0xC9, 0xD2, 0x9C, 0xBB, 0xBA, 0x76, + 0x23, 0x55, 0xD3, 0x5A, 0x01, 0xE9, 0x87, 0x07, + 0x19, 0x09, 0x39, 0x8A, 0x91, 0x93, 0x12, 0xDF, + 0x22, 0xA8, 0xCF, 0x4E, 0x4D, 0x65, 0xB0, 0x0F, + 0x13, 0x53, 0x21, 0x8C, 0xE5, 0xB7, 0x0B, 0x0E, + 0x6C, 0x44, 0xCA, 0x7B, 0xC5, 0x6E, 0xCE, 0xE3, + 0x14, 0x29, 0xAC, 0x2E, 0xE7, 0x59, 0xE8, 0x0A, + 0xEA, 0x66, 0x7C, 0x94, 0x6D, 0x05, 0x9E, 0x9A, + 0x2B, 0x38, 0x6A, 0xCB, 0x51, 0xEF, 0x06, 0xDA, + 0xFD, 0x47, 0x92, 0x1D, 0xA5, 0x37, 0x33, 0xEC, + 0xB4, 0x52, 0x56, 0xC3, 0xF4, 0xF8, 0x8B, 0xD0, + 0xA4, 0x5F, 0x28, 0x89, 0x75, 0xC7, 0x04, 0x00, + 0xE4, 0x86, 0x36, 0x3A, 0x99, 0x16, 0x7D, 0xE0, + 0x7A, 0x4C, 0x54, 0x46, 0x73, 0xB2, 0xF3, 0xE1, + 0x62, 0xBE, 0x90, 0x4A, 0x24, 0x6B, 0x3E, 0xAA, + 0x1B, 0xF2, 0x60, 0xD4, 0xA9, 0x9B, 0x1A, 0xB8, + 0xA1, 0x35, 0xAE, 0xB6, 0x10, 0x5C, 0x17, 0xBC, + 0xAB, 0x8D, 0x02, 0x74, 0xBD, 0x3D, 0x8E, 0xDD }; + +unsigned char table_16[256] = { + 0x3F, 0x9C, 0x17, 0xC1, 0x59, 0xC6, 0x23, 0x93, + 0x4B, 0xDF, 0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, 0xFF, 0x88, 0xB5, + 0xF8, 0xBF, 0x8B, 0x6F, 0x4E, 0x79, 0x40, 0xCA, + 0x24, 0x26, 0xDC, 0x33, 0xEB, 0x2D, 0x5B, 0x1B, + 0x9D, 0xC7, 0x49, 0x48, 0x54, 0x85, 0xEF, 0xD7, + 0xC2, 0xB8, 0xC8, 0x5D, 0xD9, 0x3B, 0x15, 0xBB, + 0x65, 0xE3, 0xD6, 0x30, 0x3E, 0x1E, 0x32, 0x9E, + 0x57, 0x81, 0x34, 0x06, 0xFC, 0xBA, 0x7D, 0x20, + 0x70, 0xDA, 0x7E, 0x47, 0x94, 0x61, 0xB0, 0x78, + 0xF4, 0xBE, 0xEA, 0x19, 0x43, 0x01, 0xB1, 0x96 }; + +unsigned char table_17[256] = { + 0x7E, 0xF1, 0xD3, 0x75, 0x87, 0xA6, 0xED, 0x9E, + 0xA9, 0xD5, 0xC6, 0xBF, 0xE6, 0x6A, 0xEE, 0x4B, + 0x34, 0xDF, 0x4C, 0x7D, 0xDD, 0xFE, 0x3F, 0xAF, + 0x66, 0x2D, 0x74, 0x6F, 0xFC, 0x4F, 0x5F, 0x88, + 0x29, 0x7B, 0xC7, 0x2A, 0x70, 0xE8, 0x1D, 0xDE, + 0xD0, 0x55, 0x71, 0x81, 0xC4, 0x0D, 0x50, 0x4E, + 0x58, 0x00, 0x96, 0x97, 0xBB, 0xD7, 0x53, 0x15, + 0x6C, 0x40, 0x17, 0xC9, 0xFF, 0x8F, 0x94, 0xFB, + 0x19, 0x9A, 0x3E, 0xB5, 0x5A, 0x5E, 0x86, 0x24, + 0xB8, 0x77, 0xBA, 0x85, 0x51, 0x18, 0xBE, 0x59, + 0x79, 0xF3, 0xD4, 0xC3, 0xAB, 0x28, 0xFD, 0x25, + 0x41, 0x91, 0x07, 0x8D, 0xAE, 0x49, 0xF5, 0x80, + 0x35, 0xA1, 0x9C, 0x3C, 0xE2, 0x65, 0xB3, 0xE0, + 0x16, 0xCB, 0x12, 0x6B, 0xF7, 0xB1, 0x93, 0x8A, + 0xCE, 0x54, 0x4D, 0xF8, 0x13, 0xA2, 0x95, 0x46, + 0xEA, 0x61, 0x57, 0x9D, 0x27, 0x8B, 0x3D, 0x60, + 0x36, 0x68, 0x06, 0x56, 0xB6, 0x1B, 0xD2, 0x89, + 0x10, 0xA7, 0xC5, 0x1A, 0x0B, 0x2C, 0xBD, 0x14, + 0x0A, 0xDC, 0x23, 0xA8, 0xE1, 0x04, 0x02, 0xC0, + 0xB2, 0x9B, 0xE3, 0x2E, 0x33, 0x7C, 0x32, 0xAC, + 0x7A, 0x39, 0xB0, 0xF9, 0x98, 0x5B, 0x3A, 0x48, + 0x21, 0x90, 0xB9, 0x20, 0xF0, 0xA0, 0x09, 0x1F, + 0x2F, 0xEF, 0xEB, 0x22, 0x78, 0x82, 0x37, 0xD6, + 0xD1, 0x84, 0x76, 0x01, 0xDB, 0x43, 0xC2, 0xB7, + 0x7F, 0xA4, 0xE5, 0xC1, 0x1C, 0x69, 0x05, 0xEC, + 0xD8, 0x38, 0x67, 0x42, 0x72, 0xBC, 0x73, 0xAD, + 0xA3, 0xE9, 0x4A, 0x8E, 0x47, 0x1E, 0xC8, 0x6E, + 0xDA, 0x5D, 0x2B, 0xF6, 0x30, 0x63, 0xCC, 0xF4, + 0xCD, 0x8C, 0x0F, 0x3B, 0xE7, 0xD9, 0xCF, 0xB4, + 0x03, 0x92, 0x0E, 0x31, 0xE4, 0x08, 0xF2, 0x45, + 0xCA, 0x83, 0x26, 0x5C, 0xA5, 0x44, 0x64, 0x6D, + 0x9F, 0x99, 0x62, 0xAA, 0xFA, 0x11, 0x0C, 0x52 }; + +unsigned char table_18[256] = { + 0x0F, 0x42, 0x3D, 0x86, 0x3E, 0x66, 0xFE, 0x5C, + 0x52, 0xE2, 0xA3, 0xB3, 0xCE, 0x16, 0xCC, 0x95, + 0xB0, 0x8B, 0x82, 0x3B, 0x93, 0x7D, 0x62, 0x08, + 0x1C, 0x6E, 0xBB, 0xCB, 0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87, + 0x1B, 0xEE, 0x46, 0x2A, 0xF3, 0xBF, 0x12, 0x96, + 0x58, 0x2B, 0xF9, 0xB6, 0xCF, 0x22, 0x3C, 0xAB, + 0x1E, 0x6C, 0x31, 0xC6, 0xF7, 0x78, 0x45, 0x17, + 0xE9, 0x7E, 0x73, 0xF2, 0x55, 0xFB, 0x3F, 0x9B, + 0xF4, 0xBD, 0xA4, 0x29, 0x60, 0x03, 0xB9, 0x50, + 0xFA, 0x4E, 0xEF, 0x54, 0xE6, 0x7F, 0xC0, 0x67 }; + +unsigned char table_19[256] = { + 0xEA, 0xE7, 0x13, 0x14, 0xB9, 0xC0, 0xC4, 0x42, + 0x49, 0x6E, 0x2A, 0xA6, 0x65, 0x3C, 0x6A, 0x40, + 0x07, 0xCD, 0x4F, 0xFE, 0xF2, 0x2D, 0xC8, 0x30, + 0x9D, 0xBE, 0x1B, 0x9B, 0x4A, 0x7E, 0x9F, 0xA7, + 0x78, 0xAB, 0x4D, 0x1D, 0xF1, 0x96, 0x32, 0x84, + 0xFB, 0x80, 0x88, 0xE8, 0x41, 0x97, 0xDC, 0xD0, + 0x4E, 0x33, 0xA4, 0x3B, 0xE0, 0xDD, 0x36, 0xC9, + 0x72, 0x48, 0x8A, 0x2F, 0x35, 0xF0, 0xDF, 0x21, + 0xE1, 0xE5, 0x6C, 0x9A, 0x60, 0x8F, 0xB7, 0x24, + 0xE4, 0x9E, 0x8C, 0x0F, 0x3D, 0x28, 0xBB, 0xD6, + 0x69, 0xA0, 0x66, 0xC7, 0xE3, 0xD8, 0x11, 0x27, + 0xD9, 0x37, 0xF4, 0xF5, 0x8E, 0xD4, 0x76, 0xE2, + 0xDB, 0x15, 0xA2, 0x5C, 0x9C, 0xEE, 0x44, 0xED, + 0x2B, 0xB3, 0x75, 0x74, 0x71, 0x8B, 0x3A, 0x91, + 0x06, 0x19, 0xC1, 0x57, 0x89, 0xCC, 0x82, 0x10, + 0x17, 0xB2, 0x08, 0x70, 0x39, 0xCA, 0xBA, 0xB5, + 0xAA, 0xBF, 0x02, 0xBD, 0x26, 0x58, 0x04, 0x54, + 0x23, 0x4B, 0x90, 0x51, 0x6D, 0x98, 0xD5, 0xB0, + 0xAF, 0x22, 0xDA, 0xB4, 0x87, 0xFC, 0x7D, 0x18, + 0x6F, 0x64, 0x59, 0x09, 0x0C, 0xA5, 0x5D, 0x03, + 0x0A, 0xD3, 0xCE, 0x99, 0x8D, 0xC2, 0xC3, 0x62, + 0xD2, 0x83, 0x1A, 0xAC, 0x7C, 0x93, 0xD7, 0xA9, + 0x16, 0xF7, 0x77, 0xE6, 0x3E, 0x05, 0x73, 0x55, + 0x43, 0x95, 0x7A, 0x6B, 0x38, 0x67, 0x3F, 0xC6, + 0xAD, 0x0E, 0x29, 0x46, 0x45, 0xFA, 0xBC, 0xEC, + 0x5B, 0x7F, 0x0B, 0x1C, 0x01, 0x12, 0x85, 0x50, + 0xF9, 0xEF, 0x25, 0x34, 0x79, 0x2E, 0xEB, 0x00, + 0x5F, 0x86, 0xF8, 0x4C, 0xA8, 0x56, 0xB6, 0x5A, + 0xF3, 0x31, 0x94, 0x92, 0xB1, 0xB8, 0x52, 0xD1, + 0xCF, 0xCB, 0xA1, 0x81, 0x68, 0x47, 0xFF, 0xC5, + 0xFD, 0x1F, 0xDE, 0x53, 0xA3, 0x2C, 0x20, 0xF6, + 0x1E, 0x0D, 0xAE, 0x7B, 0x5E, 0x61, 0xE9, 0x63 }; + +unsigned char table_20[32] = { + 0x0D, 0x0B, 0x11, 0x02, 0x05, 0x1B, 0x08, 0x1D, + 0x04, 0x14, 0x01, 0x09, 0x00, 0x19, 0x1E, 0x15, + 0x1F, 0x0A, 0x0F, 0x1C, 0x10, 0x16, 0x0C, 0x07, + 0x13, 0x1A, 0x06, 0x17, 0x0E, 0x12, 0x18, 0x03 }; + +unsigned char table_21[256] = { + 0x4C, 0x94, 0xAD, 0x66, 0x9E, 0x69, 0x04, 0xA8, + 0x61, 0xE0, 0xE1, 0x3D, 0xFD,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0xE9, + 0xF9, 0x62, 0xB7, 0xB9, 0x53, 0x75, 0x5B, 0x8B, + 0xCC, 0x6C, 0x18, 0x49, 0x89, 0x31, 0xB0, 0x92, + 0x6F, 0xDF, 0x03, 0x57, 0xF3, 0x58, 0xCA, 0x2B, + 0x93, 0xA1, 0xD6, 0x24, 0x29, 0xCD, 0x59, 0x1C, + 0x83, 0xB3, 0x42, 0xBF, 0x82, 0xB4, 0x11, 0x4A, + 0x08, 0xEE, 0x76, 0x4D, 0x12, 0xDC, 0xE6, 0xC2, + 0x56, 0xBA, 0x86, 0x28, 0x6A, 0x20, 0x51, 0xF7, + 0xFF, 0xD8, 0xE7, 0xDD, 0xBB, 0x78, 0xD5, 0x81 }; + +unsigned char table_22[32] = { + 0x0B, 0x15, 0x1C, 0x0C, 0x06, 0x0A, 0x1D, 0x16, + 0x12, 0x0E, 0x04, 0x11, 0x1F, 0x0F, 0x07, 0x02, + 0x17, 0x13, 0x19, 0x18, 0x0D, 0x10, 0x1A, 0x05, + 0x03, 0x00, 0x01, 0x08, 0x09, 0x14, 0x1B, 0x1E }; + +unsigned char table_23[256] = { + 0x36, 0x53, 0x2D, 0xD0, 0x7A, 0xF0, 0xD5, 0x1C, + 0x50, 0x61, 0x9A, 0x90, 0x0B, 0x29, 0x20, 0x77, + 0xF1, 0x82, 0xFE, 0xC1, 0xA7, 0xB6, 0x78, 0x87, + 0x02, 0x05, 0xCB, 0x28, 0xAE, 0xD6, 0x17, 0x1A, + 0x91, 0x5D, 0xB9, 0xE2, 0xDE, 0x6A, 0x4E, 0x07, + 0xAC, 0x38, 0x13, 0x3B, 0x46, 0xFD, 0xB7, 0xD1, + 0x79, 0xFB, 0x58, 0x76, 0x08, 0x47, 0x95, 0xA6, + 0x99, 0x9E, 0x12, 0x67, 0xC2, 0xED, 0x9C, 0x1B, + 0x89, 0x71, 0xB5, 0x4A, 0xAA, 0x5F, 0x34, 0x85, + 0x40, 0x2B, 0x9F, 0x37, 0x7C, 0x0F, 0xD4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unsigned char table_24[256] = { + 0xDC, 0x5A, 0xE6, 0x59, 0x64, 0xDA, 0x58, 0x40, + 0x95, 0xF8, 0x2A, 0xE0, 0x39, 0x7E, 0x32, 0x89, + 0x09, 0x93, 0xED, 0x55, 0xC3, 0x5B, 0x1A, 0xD1, + 0xA5, 0x8B, 0x0F, 0x13, 0xC9, 0xE1, 0x34, 0xD0, + 0xB6, 0xA2, 0xD9, 0x52, 0x57, 0x83, 0xFD, 0xE9, + 0xAC, 0x73, 0x6E, 0x21, 0xF1, 0x0E, 0x25, 0xCC, + 0x36, 0xFB, 0xF7, 0x92, 0x15, 0x30, 0x54, 0x91, + 0xD6, 0x9E, 0xAA, 0x35, 0x70, 0xB2, 0xC0, 0x27, + 0xFE, 0x04, 0xBC, 0xC7, 0x02, 0xFA, 0x7D, 0xE3, + 0xBE, 0x62, 0x79, 0x2B, 0x31, 0x6A, 0x8F, 0x7F, + 0x56, 0xF0, 0xB4, 0x0C, 0x1F, 0x68, 0xB7, 0xB9, + 0x0B, 0x14, 0x3E, 0xA9, 0x4B, 0x03, 0x10, 0xEE, + 0x2C, 0xAB, 0x8A, 0x77, 0xB1, 0xE7, 0xCA, 0xD4, + 0x98, 0x01, 0xAD, 0x1E, 0x50, 0x26, 0x82, 0x44, + 0xF3, 0xBF, 0xD3, 0x6B, 0x33, 0x0A, 0x3C, 0x5D, + 0xCE, 0x81, 0xC5, 0x78, 0x9F, 0xB8, 0x23, 0xDB, + 0x4E, 0xA1, 0x41, 0x76, 0xAE, 0x51, 0x86, 0x06, + 0x7A, 0x66, 0xA0, 0x5E, 0x29, 0x17, 0x84, 0x4A, + 0xB0, 0x3B, 0x3D, 0x71, 0x07, 0x7B, 0x0D, 0x9A, + 0x6F, 0x9B, 0x5C, 0x88, 0xB3, 0xD7, 0x24, 0xD5, + 0x48, 0xF5, 0xE8, 0xE4, 0xCF, 0x16, 0xA4, 0xC8, + 0xEF, 0x42, 0x22, 0xEC, 0x47, 0x69, 0x90, 0x63, + 0xE2, 0x1B, 0x87, 0x85, 0x3F, 0xDE, 0x8C, 0x60, + 0x99, 0xE5, 0x8E, 0x4F, 0xF4, 0xBA, 0xB5, 0x9C, + 0x37, 0x67, 0xBD, 0xA6, 0x97, 0xDD, 0xCB, 0x43, + 0x45, 0x19, 0x49, 0x1C, 0x75, 0xC1, 0xBB, 0xF2, + 0x46, 0xFC, 0x53, 0x9D, 0xD8, 0xA3, 0xDF, 0x2F, + 0xEB, 0x72, 0x94, 0xA8, 0x6D, 0xC6, 0x28, 0x4C, + 0x00, 0x38, 0xC2, 0x65, 0x05, 0x2E, 0xD2, 0x12, + 0xFF, 0x18, 0x61, 0x6C, 0x7C, 0x11, 0xAF, 0x96, + 0xCD, 0x20, 0x74, 0x08, 0x1D, 0xC4, 0xF9, 0x4D, + 0xEA, 0x8D, 0x2D, 0x5F, 0xF6, 0xA7, 0x80, 0x3A }; + +unsigned char table_25[32] = { + 0x0A, 0x11, 0x17, 0x03, 0x05, 0x0B, 0x18, 0x13, + 0x09, 0x02, 0x00, 0x1C, 0x0C, 0x08, 0x1B, 0x14, + 0x06, 0x0E, 0x01, 0x0D, 0x16, 0x1E, 0x1D, 0x19, + 0x0F, 0x1A, 0x10, 0x04, 0x12, 0x15, 0x07, 0x1F }; + +unsigned char table_26[32] = { + 0x19, 0x13, 0x1B, 0x01, 0x1C, 0x0D, 0x0C, 0x15, + 0x0B, 0x00, 0x1A, 0x0F, 0x12, 0x16, 0x08, 0x0A, + 0x03, 0x06, 0x14, 0x10, 0x18, 0x04, 0x11, 0x1D, + 0x1F, 0x07, 0x17, 0x05, 0x02, 0x0E, 0x1E, 0x09 }; + +unsigned char table_27[256] = { + 0x72, 0xF0, 0x14, 0xCB, 0x61, 0xA5, 0xB2, 0x02, + 0x75, 0x22, 0xC3, 0x9D, 0x5A, 0x63, 0xFA, 0x5F, + 0xD9, 0x55, 0x58, 0x43, 0x24, 0x7D, 0x77, 0x93, + 0xBA, 0x50, 0x1D, 0xF7, 0x49, 0x18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6, + 0xDD, 0x05, 0x25, 0x3A, 0x40, 0x21, 0x45, 0xAC, + 0x11, 0xF3, 0xA7, 0x09, 0x2A, 0x31, 0xE4, 0x0C, + 0xF8, 0x6E, 0x3E, 0xB5, 0x82, 0xFE, 0x74, 0x13, + 0x65, 0xE1, 0x2D, 0x8F, 0xE6, 0xC4, 0x00, 0x5B, + 0x4E, 0xB9, 0x66, 0xF2, 0x62, 0x36, 0x4C, 0x83, + 0x5E, 0x6F, 0x47, 0x64, 0xBC, 0x9A, 0x60, 0x7E }; + +unsigned char table_28[32] = { + 0x15, 0x05, 0x08, 0x19, 0x02, 0x18, 0x1E, 0x07, + 0x0D, 0x0C, 0x1A, 0x06, 0x17, 0x03, 0x10, 0x09, + 0x01, 0x11, 0x1C, 0x04, 0x0F, 0x1F, 0x12, 0x0B, + 0x1B, 0x13, 0x0A, 0x16, 0x0E, 0x00, 0x1D, 0x14 }; + +unsigned char table_29[256] = { + 0x34, 0x59, 0x05, 0x13, 0x09, 0x1D, 0xDF, 0x77, + 0x11, 0xA5, 0x92, 0x27, 0xCD, 0x7B, 0x5E, 0x80, + 0xF9, 0x50, 0x18, 0x24, 0xD4, 0x70, 0x4A, 0x39, + 0x66, 0xA4, 0xDB, 0xE9, 0xED, 0x48, 0xD9, 0xE7, + 0x32, 0xDA, 0x53, 0x8F, 0x72, 0xE1, 0xF6, 0xFE, + 0xD3, 0xAD, 0xA6, 0x1F, 0xB9, 0xD1, 0x0F, 0x4C, + 0x23, 0x90, 0x68, 0xBC, 0x4B, 0x9B, 0x3D, 0xAB, + 0xF0, 0x94, 0x4F, 0x1C, 0x07, 0x65, 0x7F, 0x01, + 0x5C, 0xD7, 0x21, 0x8C, 0xBF, 0x8E, 0xB8, 0x86, + 0x6C, 0x33, 0x36, 0xC1, 0x06, 0x74, 0x37, 0x84, + 0x41, 0xAE, 0x67, 0x29, 0xB4, 0x85, 0xCE, 0x2A, + 0xCB, 0x1E, 0x61, 0x9E, 0x7A, 0x44, 0x3E, 0x89, + 0x14, 0x20, 0x19, 0xBB, 0xE0, 0xAA, 0xCF, 0x83, + 0xA8, 0x93, 0x43, 0xF2, 0xAC, 0x0E, 0xD2, 0xCC, + 0xDD, 0x47, 0x58, 0xC9, 0xCA, 0x1B, 0x54, 0x6E, + 0x8A, 0x79, 0xF8, 0xC4, 0xFB, 0xD5, 0x91, 0xDE, + 0x12, 0x31, 0x99, 0xFA, 0x6D, 0xC8, 0x57, 0xEC, + 0xB7, 0x28, 0x0C, 0x52, 0xF1, 0x0D, 0xB1, 0x9A, + 0x26, 0x98, 0x16, 0x7D, 0xD0, 0x2E, 0x8B, 0xD8, + 0xE6, 0xE8, 0x30, 0xFD, 0x7C, 0x64, 0x5A, 0xBD, + 0x87, 0xE2, 0xA1, 0x3F, 0xC3, 0x38, 0x96, 0xA3, + 0x2D, 0xF3, 0x3A, 0xEE, 0xC0, 0x10, 0xEA, 0x6F, + 0x8D, 0x03, 0xF4, 0x51, 0x97, 0x7E, 0x56, 0x42, + 0x3C, 0x5D, 0x5F, 0xF5, 0x6A, 0xAF, 0xE4, 0xBE, + 0xBA, 0x78, 0xA0, 0x5B, 0x49, 0xA7, 0xC7, 0x9C, + 0x63, 0x6B, 0x00, 0x17, 0x69, 0x75, 0x3B, 0x40, + 0xEF, 0x45, 0xB5, 0x2B, 0x2F, 0x02, 0xC6, 0x22, + 0x9F, 0xFC, 0x73, 0x08, 0x81, 0xB2, 0x2C, 0x71, + 0x35, 0xA2, 0xE3, 0xB3, 0x9D, 0xC5, 0x0A, 0xC2, + 0x25, 0x82, 0xDC, 0x88, 0xA9, 0xE5, 0xF7, 0xEB, + 0xD6, 0x60, 0x76, 0x55, 0x0B, 0x4E, 0xFF, 0x1A, + 0x46, 0x62, 0xB6, 0xB0, 0x15, 0x04, 0x95, 0x4D }; + +unsigned char table_30[32] = { + 0x00, 0x1C, 0x0E, 0x0C, 0x06, 0x16, 0x09, 0x12, + 0x01, 0x13, 0x0B, 0x14, 0x11, 0x08, 0x04, 0x18, + 0x10, 0x1B, 0x15, 0x03, 0x02, 0x19, 0x1A, 0x17, + 0x1E, 0x1F, 0x0F, 0x07, 0x0D, 0x05, 0x1D, 0x0A }; + +unsigned char table_31[256] = { + 0xDF, 0xD8, 0x3F, 0xBC, 0x5F, 0xC9, 0x8E, 0x4C, + 0x0B, 0x3C, 0xE5, 0xBF, 0x39, 0xD5, 0x30, 0xDD, + 0x23, 0xC7, 0x72, 0x63, 0x1F, 0xF8, 0x96, 0x31, + 0x70, 0xD6, 0x9E, 0xE8, 0x9D, 0xF5, 0xEF, 0x65, + 0xC2, 0x50, 0x62, 0x77, 0xD3, 0x6C, 0x1A, 0x91, + 0xBB, 0xFF, 0xCD, 0x9B, 0xB6, 0xBA, 0xB8, 0x7A, + 0x14, 0xA7, 0x74, 0x89, 0xD4, 0x6E, 0x19, 0x69, + 0xAB, 0x01, 0x15, 0x0E, 0x87, 0x55, 0x79, 0x1C, + 0x18, 0xBE, 0xA8, 0xDB, 0x52, 0xD2, 0x8F, 0x7E, + 0x81, 0xAF, 0xFD, 0x5C, 0x3E, 0x1B, 0xB9, 0xB2, + 0xB7, 0x51, 0x57, 0x8C, 0xCF, 0x5B, 0xA4, 0x75, + 0xDE, 0x22, 0x8B, 0x10, 0x12, 0xC8, 0x35, 0x2D, + 0x45, 0xB5, 0xF0, 0x47, 0x88, 0x16, 0xEB, 0x67, + 0xD9, 0x0C, 0xF1, 0xC1, 0x34, 0x33, 0xC6, 0x78, + 0xB3, 0x26, 0xE3, 0xBD, 0x5D, 0x4E, 0x66, 0xE4, + 0xD7, 0xC4, 0xE6, 0xA1, 0xB0, 0x95, 0x2B, 0x9A, + 0x4A, 0x3A, 0xCB, 0x40, 0xE1, 0x60, 0x49, 0xCC, + 0x03, 0xAC, 0xF4, 0x97, 0x32, 0x0F, 0x38, 0x17, + 0xF9, 0xE0, 0xD1, 0xFB, 0x04, 0x5E, 0x68, 0x06, + 0xAE, 0xFA, 0xAA, 0xED, 0x24, 0x0D, 0x00, 0x61, + 0x20, 0xA3, 0x7B, 0x6B, 0x76, 0x27, 0xEA, 0xCE, + 0x6A, 0x82, 0x9F, 0x6D, 0x9C, 0x64, 0xA2, 0x11, + 0x37, 0x2A, 0xCA, 0x84, 0x25, 0x7C, 0x2F, 0x8D, + 0x90, 0xE7, 0x09, 0x93, 0xF3, 0x43, 0x71, 0xEC, + 0xA9, 0x7D, 0x94, 0xA6, 0x3D, 0x7F, 0x54, 0x44, + 0x99, 0x80, 0x41, 0xC0, 0xA0, 0x8A, 0x1E, 0xDC, + 0x08, 0xD0, 0x2E, 0x42, 0x05, 0x85, 0x86, 0xFE, + 0x3B, 0x59, 0xC3, 0x58, 0x13, 0xB4, 0x36, 0xA5, + 0x73, 0x28, 0x29, 0xDA, 0x4F, 0x1D, 0xB1, 0x53, + 0x46, 0x2C, 0xF2, 0x4D, 0xAD, 0xFC, 0x83, 0x02, + 0x6F, 0x07, 0xE9, 0xEE, 0x21, 0x98, 0x5A, 0xC5, + 0x92, 0x48, 0xF7, 0x0A, 0xF6, 0xE2, 0x4B, 0x56 }; + +unsigned char table_32[256] = { + 0x7B, 0x0F, 0x56, 0x2F, 0x1E, 0x2A, 0x7A, 0xD1, + 0x02, 0x91, 0x4E, 0x37, 0x6C, 0x10, 0xA7, 0xF2, + 0x38, 0xAC, 0x9E, 0x2B, 0x5E, 0x23, 0xE3, 0x19, + 0x9B, 0xF6, 0xB0, 0x59, 0x14, 0xB9, 0xA9, 0x46, + 0x84, 0x1D, 0xC0, 0x98, 0xF3, 0xE1, 0xE8, 0x94, + 0x52, 0x35, 0xBA, 0xD8, 0x07, 0xEF, 0x31, 0xF8, + 0x03, 0x76, 0x9C, 0xD7, 0xE4, 0x8B, 0xAF, 0x60, + 0xDD, 0x51, 0x00, 0xDF, 0x11, 0x7F, 0x1C, 0xED, + 0x49, 0xC9, 0xF4, 0x87, 0x64, 0xFC, 0x5D, 0xAD, + 0x88, 0x85, 0xF7, 0x5A, 0x92, 0xDB, 0x72,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table_33[256] = { + 0xDE, 0xD3, 0x79, 0x67, 0x13, 0x5C, 0x04, 0xF2, + 0xD9, 0x9F, 0x65, 0x56, 0xCC, 0x3B, 0xA4, 0x9A, + 0x08, 0xBF, 0x26, 0xB2, 0xA7, 0x5E, 0xAA, 0xCA, + 0xBB, 0x2B, 0x38, 0x3F, 0xD8, 0x87, 0xFA, 0x5D, + 0x73, 0x8E, 0x1E, 0x93, 0x05, 0xAF, 0x3E, 0x4E, + 0x90, 0xDB, 0x0B, 0x33, 0x0D, 0x2F, 0x86, 0x4F, + 0xFD, 0xD0, 0x39, 0xB1, 0x8A, 0x1A, 0x20, 0xE6, + 0xCF, 0xA2, 0x82, 0xDF, 0x42, 0x9C, 0x30, 0x40, + 0xE3, 0xB0, 0x88, 0x5A, 0xEC, 0x25, 0xE2, 0xC4, + 0x12, 0x54, 0x50, 0x97, 0x96, 0x21, 0x23, 0x7B, + 0x1D, 0x61, 0x52, 0x34, 0x7D, 0x69, 0x16, 0xC3, + 0x31, 0xF8, 0x48, 0x19, 0x95, 0x01, 0x29, 0x8C, + 0x15, 0xAC, 0x84, 0x74, 0xAB, 0x70, 0xDA, 0x36, + 0xD6, 0x8F, 0xFE, 0x35, 0xD7, 0x2E, 0x89, 0x07, + 0x62, 0x17, 0xDC, 0x92, 0x45, 0x83, 0xB5, 0xE5, + 0x8B, 0xC0, 0x27, 0x85, 0x7C, 0x9D, 0x55, 0x81, + 0x71, 0xCD, 0xC9, 0x00, 0x02, 0xC1, 0x0A, 0x37, + 0xED, 0xEA, 0xC2, 0x98, 0x49, 0x06, 0x1C, 0x78, + 0x64, 0xCE, 0x9E, 0x4C, 0x7A, 0xB4, 0x43, 0x0F, + 0xE0, 0x7E, 0xBC, 0x5B, 0x51, 0xE7, 0x18, 0xF9, + 0x11, 0xA1, 0xF5, 0xC7, 0xCB, 0x4D, 0x6A, 0x0E, + 0x57, 0xF1, 0xFB, 0xB3, 0x99, 0xF0, 0x32, 0xD5, + 0xA9, 0x4B, 0x6F, 0x6D, 0xA8, 0xC5, 0xDD, 0x7F, + 0xEB, 0xBE, 0xFC, 0x2C, 0x22, 0x58, 0x03, 0x9B, + 0x77, 0xF7, 0xBD, 0xBA, 0xD2, 0x6B, 0xAD, 0x5F, + 0x10, 0x6E, 0x09, 0xD1, 0x1B, 0x24, 0xEF, 0x72, + 0x3D, 0x59, 0x28, 0xE1, 0xB7, 0x44, 0x8D, 0xB8, + 0xAE, 0x2D, 0x60, 0xA6, 0xC8, 0x0C, 0xF4, 0x41, + 0xA3, 0x68, 0x46, 0x6C, 0x76, 0xA0, 0xB6, 0x66, + 0xE4, 0x1F, 0x75, 0x4A, 0xFF, 0x2A, 0x94, 0xD4, + 0xF3, 0xE9, 0x91, 0x63, 0xA5, 0xB9, 0xE8, 0x14, + 0x80, 0x3C, 0xEE, 0x47, 0xC6, 0x3A, 0x53, 0xF6 }; + +unsigned char table_34[256] = { + 0xF0, 0xE9, 0x3E, 0xD6, 0x89, 0xC8, 0xC7, 0x23, + 0x75, 0x26, 0x5F, 0x9C, 0x57, 0xB8, 0x2A, 0x29, + 0xE5, 0xB5, 0x68, 0xA4, 0x92, 0x46, 0x40, 0x7F, + 0xF2, 0xBC, 0x6A, 0xE0, 0x8F, 0x0F, 0xE4, 0x3A, + 0xE1, 0x30, 0x84, 0x6E, 0x82, 0x8E, 0x56, 0xC5, + 0x32, 0x85, 0xFB, 0x59, 0x43, 0x41, 0xC2, 0xF6, + 0x67, 0x5A, 0x7C, 0x34, 0xA1, 0xD0, 0x4B, 0xAC, + 0x61, 0x72, 0x6B, 0xAF, 0xC4, 0x20, 0x9A, 0xD4, + 0x74, 0x8D, 0x87, 0x83, 0xE2, 0x62, 0x6D, 0xE6, + 0xE7, 0xF9, 0x76, 0xCB, 0x18, 0x90, 0x4F, 0xFF, + 0xD3, 0x3C, 0x08, 0x79, 0x93, 0x2D, 0x95, 0xA3, + 0xDD, 0x5B, 0xDA, 0x7A, 0x39, 0x4D, 0xC1, 0x2E, + 0xCC, 0x53, 0xE8, 0xA2, 0xCF, 0x15, 0x78, 0x1C, + 0xEB, 0x9B, 0x7B, 0xAD, 0x31, 0x2F, 0xE3, 0xC9, + 0x3B, 0xEC, 0x2C, 0x49, 0x02, 0x52, 0x28, 0xBA, + 0x0C, 0x19, 0x24, 0xF7, 0x97, 0x09, 0xA6, 0xA0, + 0xDF, 0xD1, 0xD2, 0xDC, 0x51, 0xA5, 0x94, 0xFD, + 0x71, 0xF5, 0x50, 0x0A, 0x69, 0x25, 0x88, 0x5C, + 0x91, 0xD5, 0x47, 0x0B, 0x27, 0x13, 0x96, 0xD9, + 0xF1, 0xA9, 0x70, 0xC3, 0xBE, 0x42, 0x4E, 0x4A, + 0xB1, 0x07, 0xA7, 0x54, 0xFE, 0x48, 0x9F, 0x63, + 0x17, 0xAE, 0xB9, 0x58, 0x21, 0x35, 0xED, 0x5D, + 0x9D, 0x3D, 0xB4, 0xFC, 0xEA, 0x8C, 0x80, 0xA8, + 0x1E, 0xB0, 0xDE, 0x0D, 0x11, 0x6F, 0x04, 0x12, + 0xF4, 0x10, 0x64, 0x0E, 0xD7, 0x2B, 0xB3, 0x8B, + 0xB7, 0x01, 0x86, 0xCA, 0xFA, 0x9E, 0xEE, 0x66, + 0x37, 0x65, 0x81, 0x38, 0x1F, 0xAA, 0x73, 0xAB, + 0xBD, 0xDB, 0x14, 0xCD, 0x00, 0xBB, 0x98, 0x44, + 0x45, 0xB6, 0x99, 0x5E, 0xD8, 0x1D, 0x36, 0xF8, + 0x55, 0x6C, 0x16, 0x7E, 0x77, 0x3F, 0x22, 0xEF, + 0xF3, 0x7D, 0xC6, 0xCE, 0x8A, 0xB2, 0x33, 0x4C, + 0x03, 0x05, 0xBF, 0x06, 0x1B, 0xC0, 0x1A, 0x60 }; + +unsigned char table_35[256] = { + 0xCC, 0x40, 0xEF, 0x1F, 0xDB, 0xE5, 0x71, 0x51, + 0x3B, 0x0F, 0x7D, 0x9C, 0x83, 0x17, 0x6F, 0x8F, + 0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6E, 0xD1, 0x94, 0xB9, 0x93, + 0xDD, 0xF6, 0xA6, 0xFB, 0xC2, 0xB6, 0x0C, 0xE9, + 0x77, 0xF9, 0xCD, 0x08, 0xEE, 0x3F, 0xE6, 0x75, + 0xD6, 0x84, 0x76, 0x8C, 0xF0, 0xAE, 0xD2, 0x78, + 0x2F, 0x4B, 0x16, 0x4C, 0x27, 0x81, 0x6D, 0x99, + 0x38, 0xD3, 0x54, 0x62, 0x74, 0x20, 0x60, 0xC3, + 0x7C, 0x8D, 0x72, 0x0B, 0x52, 0xE8, 0xA7, 0x3A, + 0x59, 0xC4, 0x9F, 0xD0, 0x66, 0x7B, 0x33, 0xB5 }; + +unsigned char table_36[256] = { + 0xDB, 0x6F, 0xFE, 0xB3, 0x5C, 0x1F, 0xB8, 0xBF, + 0xA3, 0x71, 0x11, 0x56, 0x90, 0xE2, 0x63, 0x18, + 0x83, 0x51, 0x21, 0xEB, 0x66, 0x08, 0xA6, 0xA5, + 0x1C, 0xF5, 0x14, 0x24, 0x41, 0x33, 0xA7, 0xB5, + 0xC7, 0x79, 0x57, 0x50, 0x85, 0xE1, 0x6D, 0xF7, + 0x0E, 0xDE, 0x67, 0xAB, 0xA1, 0x0B, 0xD9, 0x4A, + 0xCA, 0x36, 0xEA, 0xDA, 0x16, 0xEF, 0x9F, 0x0A, + 0x09, 0x9A, 0x1D, 0xC5, 0xD7, 0x5F, 0x19, 0xDC, + 0x15, 0x06, 0xE8, 0x94, 0x0C, 0x0D, 0xC9, 0x7C, + 0xD6, 0x62, 0xBB, 0x49, 0xF9, 0x61, 0x07, 0x9B, + 0x28, 0xC3, 0x9E, 0xF4, 0x38, 0x78, 0x20, 0x03, + 0xA2, 0x7F, 0xC2, 0x9D, 0x5E, 0x65, 0x52, 0x17, + 0x2E, 0x1B, 0xB0, 0x42, 0xBC, 0xFD, 0xF1, 0xD2, + 0xF6, 0x60, 0xD3, 0x29, 0x97, 0x3D, 0x0F, 0xB1, + 0x2F, 0x22, 0xDD, 0x80, 0x32, 0xF8, 0xAD, 0x70, + 0xB9, 0x8F, 0x37, 0xCE, 0x46, 0x58, 0xB7, 0x30, + 0xED, 0x7A, 0xE9, 0xC0, 0x7D, 0x13, 0x64, 0x23, + 0x4E, 0xC8, 0xF0, 0xCC, 0x3B, 0x45, 0x68, 0x8D, + 0xBE, 0x8B, 0xD8, 0x43, 0x02, 0x27, 0xE4, 0xAA, + 0x10, 0xF2, 0x59, 0x72, 0x40, 0x26, 0x69, 0xE5, + 0x05, 0x84, 0x4F, 0xE0, 0x6B, 0xC1, 0xAC, 0x4C, + 0xFB, 0x31, 0x77, 0x8E, 0xD4, 0x12, 0xA9, 0xB4, + 0xEC, 0x00, 0x76, 0x1E, 0x25, 0xAE, 0xE7, 0x3C, + 0x35, 0x93, 0x9C, 0xC4, 0xFC, 0x2D, 0x91, 0x04, + 0xAF, 0x53, 0x3F, 0xE6, 0xA4, 0xD0, 0x1A, 0xDF, + 0x3A, 0x55, 0x99, 0x01, 0xCB, 0x6C, 0x82, 0x3E, + 0x5D, 0xA8, 0x88, 0x54, 0x5B, 0x95, 0xCD, 0x8C, + 0x81, 0x34, 0xD1, 0x39, 0xFF, 0xEE, 0xFA, 0x8A, + 0x6E, 0x86, 0x92, 0x89, 0xF3, 0x6A, 0xBA, 0x2C, + 0xD5, 0x44, 0xC6, 0x96, 0xBD, 0xB2, 0x2B, 0x87, + 0x74, 0xA0, 0x73, 0x5A, 0x2A, 0x98, 0x75, 0x47, + 0x4B, 0xB6, 0x7B, 0x4D, 0xCF, 0x7E, 0x48, 0xE3 }; + +unsigned char table_37[256] = { + 0x1F, 0xD6, 0xB1, 0xB3, 0x40, 0xAD, 0xDE, 0xB7, + 0x19, 0xB4, 0xE7, 0x0B, 0x9C, 0x2D, 0xE0, 0xF5, + 0xCF, 0x2C, 0x30, 0x65, 0x2F, 0xCD, 0x02, 0x91, + 0xCE, 0x2B, 0xBF, 0x78, 0xE6, 0xFA, 0x51, 0x48, + 0xFB, 0x4D, 0xBE, 0x71, 0x1A, 0x56, 0xFD, 0x81, + 0x33, 0x75, 0x89, 0x96, 0x37, 0x82, 0x9E, 0x93, + 0x41, 0x18, 0x5B, 0x2E, 0x22, 0x0F, 0xAF, 0x4B, + 0xB9, 0xD5, 0xEE, 0x6C, 0xE4, 0x05, 0xCC, 0x99, + 0xE5, 0x3B, 0x62, 0xBD, 0x7B, 0xAA, 0x4A, 0xE2, + 0x34, 0x43, 0xF7, 0x39, 0xFE, 0x14, 0x1D, 0xE3, + 0xF0, 0xA7, 0x77, 0xDF, 0xA0, 0xD3, 0xAC, 0xD9, + 0xEA, 0x76, 0xDD, 0xA4, 0xC5, 0xC9, 0x61, 0xF3, + 0xA8, 0xB0, 0x35, 0xE8, 0x68, 0xD4, 0x15, 0xF9, + 0x97, 0xED, 0x25, 0x0A, 0x88, 0x8F, 0x06, 0xA3, + 0x16, 0x36, 0x32, 0xA2, 0xC6, 0x64, 0xD7, 0x94, + 0xD2, 0x6D, 0x74, 0xFC, 0x44, 0x27, 0x5C, 0xFF, + 0x60, 0x1E, 0x58, 0x8B, 0x5E, 0xC7, 0x90, 0x17, + 0x63, 0xAE, 0xC3, 0x12, 0x13, 0x84, 0xEC, 0x49, + 0xA5, 0x9B, 0x31, 0x8D, 0xE1, 0x79, 0xF1, 0x00, + 0x28, 0x3D, 0xC2, 0x55, 0x20, 0x52, 0x95, 0x7E, + 0x42, 0x1C, 0x66, 0x92, 0x7D, 0xB6, 0xC4, 0xF4, + 0x80, 0xB2, 0x72, 0x6E, 0x11, 0xF6, 0x0D, 0x5A, + 0xEF, 0x9D, 0x69, 0x9A, 0x45, 0x67, 0x3F, 0xDA, + 0x8E, 0x57, 0x09, 0x7C, 0x38, 0xA6, 0x83, 0x87, + 0x7A, 0x08, 0x4C, 0x5F, 0x85, 0x7F, 0xD0, 0x04, + 0x50, 0xCB, 0xB8, 0x07, 0x24, 0x26, 0x29, 0x46, + 0x01, 0x03, 0xC1, 0xD8, 0xDC, 0x0E, 0x3C, 0x4F, + 0x53, 0x4E, 0xB5, 0xF8, 0xC0, 0x8A, 0xF2, 0xBB, + 0xE9, 0x5D, 0x2A, 0xBA, 0x0C, 0x1B, 0x3A, 0xA9, + 0x21, 0x6A, 0x70, 0xBC, 0xEB, 0xA1, 0x54, 0x10, + 0x98, 0x9F, 0x23, 0xD1, 0x6B, 0x59, 0x3E, 0xCA, + 0x73, 0xC8, 0x86, 0x47, 0xDB, 0xAB, 0x6F, 0x8C }; + +unsigned char table_38[256] = { + 0xAA, 0x8D, 0x37, 0x94, 0x99, 0xDD, 0x70, 0x77, + 0x78, 0xC9, 0x0F, 0xFA, 0xE2, 0x05, 0xC2, 0x16, + 0x02, 0x4D, 0x44, 0x65, 0xAC, 0xB0, 0x39, 0xF8, + 0x06, 0x60, 0xD8, 0xE1, 0x19, 0xB4, 0x36, 0x20, + 0x59, 0x1D, 0xAD, 0xE4, 0xE8, 0xFF, 0x9D, 0x0D, + 0x51, 0x28, 0xE7, 0x8C, 0x0E, 0x97, 0xE3, 0xAE, + 0x6A, 0x27, 0x98, 0xDB, 0x26, 0xF6, 0xEC, 0xC6, + 0xC0, 0xBD, 0x68, 0x61, 0x83, 0x86, 0xE0, 0x2C, + 0xEE, 0x47, 0xF9, 0x5F, 0x6D, 0xBA, 0xE9, 0x72, + 0x8A, 0xBB, 0x08, 0x29, 0xAF, 0x1C, 0xD3, 0x5D, + 0xF7, 0x87, 0x6F, 0x9A, 0x2F, 0x11, 0xD9, 0x90, + 0x66, 0x8E, 0xEB, 0xB1, 0x2E, 0xEA, 0xA3, 0x55, + 0x2B, 0xCC, 0x4C, 0x4B, 0x48, 0x71, 0x3B, 0xFC, + 0xA4, 0x45, 0x0A, 0x8F, 0x7A, 0x13, 0x01, 0x22, + 0xC1, 0xF1, 0xA2, 0xB8, 0x7C, 0xF4, 0xB3, 0xB7, + 0x5B, 0xE5, 0x07, 0x50, 0x7E, 0x18, 0xEF, 0x91, + 0x5C, 0x15, 0x69, 0xBE, 0x0C, 0x93, 0x56, 0x35, + 0x7B, 0xCF, 0x34, 0x74, 0x3E, 0x5E, 0x31, 0x21, + 0x12, 0x63, 0x7F, 0x2A, 0x9B, 0xD4, 0x6B, 0xBC, + 0x33, 0x62, 0x30, 0x75, 0x17, 0x23, 0xB2, 0xF0, + 0x57, 0x67, 0x95, 0x3D, 0xCD, 0x10, 0xE6, 0xC8, + 0x8B, 0xA9, 0x73, 0xC4, 0x43, 0xBF, 0xA7, 0xCA, + 0xB5, 0xD5, 0xD6, 0x3F, 0x1A, 0x7D, 0x82, 0xA8, + 0x40, 0x64, 0xAB, 0x04, 0xC3, 0x1F, 0xA0, 0x5A, + 0x85, 0xF3, 0xDE, 0xFE, 0xDA, 0x1E, 0x81, 0x92, + 0x9C, 0x2D, 0x9F, 0x32, 0xB9, 0xA1, 0x96, 0xD0, + 0x4F, 0x38, 0x80, 0xCB, 0x6C, 0x14, 0x84, 0x1B, + 0xD7, 0xC5, 0xED, 0xD2, 0x3A, 0x0B, 0x88, 0xFD, + 0xDC, 0x49, 0x9E, 0xF5, 0xF2, 0x52, 0xA6, 0x24, + 0xC7, 0xB6, 0x03, 0x3C, 0xD1, 0x54, 0x41, 0xDF, + 0x89, 0x58, 0x79, 0xFB, 0x6E, 0xA5, 0x42, 0x25, + 0x09, 0x76, 0x00, 0x46, 0x4E, 0x53, 0xCE, 0x4A }; + +unsigned char table_39[32] = { + 0x12, 0x18, 0x0E, 0x08, 0x16, 0x05, 0x06, 0x00, + 0x11, 0x17, 0x15, 0x1B, 0x14, 0x01, 0x1F, 0x19, + 0x04, 0x0D, 0x0A, 0x0F, 0x10, 0x07, 0x1D, 0x03, + 0x0B, 0x13, 0x0C, 0x09, 0x1E, 0x02, 0x1A, 0x1C }; + +unsigned char table_40[32] = { + 0x16, 0x02, 0x06, 0x0E, 0x0D, 0x1C, 0x08, 0x0A, + 0x0F, 0x13, 0x0B, 0x18, 0x07, 0x04, 0x14, 0x01, + 0x1B, 0x05, 0x17, 0x1E, 0x11, 0x1A, 0x10, 0x1F, + 0x12, 0x19, 0x1D, 0x03, 0x0C, 0x00, 0x09, 0x15 }; + +unsigned char table_41[32] = { + 0x13, 0x18, 0x04, 0x1F, 0x1D, 0x11, 0x03, 0x00, + 0x10, 0x12, 0x06, 0x0A, 0x1C, 0x07, 0x15, 0x0E, + 0x08, 0x05, 0x0C, 0x09, 0x01, 0x02, 0x16, 0x0B, + 0x1A, 0x17, 0x14, 0x1E, 0x0D, 0x0F, 0x19, 0x1B }; + +unsigned char table_42[32] = { + 0x00, 0x08, 0x15, 0x1D, 0x05, 0x18, 0x06, 0x07, + 0x1F, 0x01, 0x0B, 0x03, 0x19, 0x13, 0x02, 0x1C, + 0x17, 0x11, 0x0E, 0x1E, 0x0C, 0x0F, 0x09, 0x1A, + 0x1B, 0x16, 0x10, 0x0D, 0x0A, 0x14, 0x12, 0x04 }; + +unsigned char table_43[256] = { + 0x34, 0xB7, 0x36, 0x85, 0x5F, 0x93, 0x98, 0x70, + 0x1E, 0x59, 0x83, 0x60, 0x6F, 0xBF, 0xF9, 0xD0, + 0xB3, 0x22, 0x12, 0x38, 0xF5, 0x01, 0xC9, 0x5B, + 0xEF, 0x1D, 0x81, 0x64, 0xFA, 0x8F, 0x7F, 0xBC, + 0x05, 0x08, 0xE0, 0x8B, 0xE8, 0x86, 0x95, 0xCB, + 0xCA, 0x5A, 0xEB, 0x10, 0x92, 0xE2, 0x7E, 0x28, + 0xD9, 0xC7, 0x0D, 0x24, 0xA7, 0x02, 0x0B, 0xF1, + 0x7B, 0xD3, 0xFE, 0x2B, 0x89, 0x0E, 0xAE, 0xAD, + 0xC8, 0x82, 0x79, 0x43, 0x96, 0xDE, 0x0C, 0x9A, + 0x57, 0x84, 0xB4, 0x19, 0xF8, 0xF0, 0xAF, 0xBE, + 0x99, 0x9F, 0x46, 0xE4, 0x31, 0xDF, 0x30, 0x51, + 0xD4, 0xE5, 0xFC, 0x32, 0x04, 0x56, 0x7D, 0x33, + 0xF7, 0x18, 0x23, 0x4E, 0xC2, 0x7C, 0x6C, 0xD2, + 0xB1, 0x9B, 0x40, 0xA2, 0x88, 0x00, 0xA1, 0xAB, + 0xC6, 0x5C, 0x87, 0x3B, 0xD7, 0x27, 0x2E, 0x45, + 0xDA, 0x8E, 0x61, 0x5E, 0xFB, 0x09, 0x5D, 0x6B, + 0xA3, 0x29, 0x4F, 0xAC, 0xD1, 0x77, 0x4A, 0xA9, + 0xC4, 0x7A, 0x15, 0xD8, 0xAA, 0x17, 0xB9, 0x2D, + 0xE7, 0xBD, 0x2C, 0x62, 0x2F, 0xB2, 0xED, 0x3F, + 0x48, 0x26, 0x1B, 0x35, 0x20, 0x72, 0x4D, 0xFF, + 0xBB, 0x78, 0x1F, 0xCC, 0xEC, 0xA8, 0x9D, 0x90, + 0x4B, 0x13, 0xE1, 0xBA, 0xF3, 0x3C, 0x42, 0x65, + 0x14, 0xDD, 0x75, 0xE3, 0x4C, 0x74, 0x94, 0xCD, + 0xF2, 0x66, 0x06, 0xE9, 0x49, 0xB8, 0x71, 0x41, + 0xA0, 0x25, 0x55, 0x47, 0x97, 0x9E, 0x11, 0x54, + 0x1A, 0xB0, 0x3E, 0x37, 0x39, 0x1C, 0x8D, 0x03, + 0x6E, 0xF6, 0x80, 0x6D, 0x8C, 0x9C, 0xB6, 0xCF, + 0xC3, 0x91, 0x63, 0xC0, 0x07, 0x67, 0xE6, 0xF4, + 0xCE, 0x3D, 0xDB, 0x16, 0xFD, 0xEA, 0xD6, 0x68, + 0xD5, 0xA6, 0x0F, 0x58, 0x44, 0x52, 0xB5, 0xDC, + 0x0A, 0x69, 0xC5, 0xA5, 0xC1, 0x8A, 0x2A, 0xEE, + 0x73, 0x76, 0x3A, 0x21, 0x53, 0xA4, 0x50, 0x6A }; + +unsigned char table_44[32] = { + 0x1A, 0x0E, 0x0A, 0x17, 0x1F, 0x08, 0x10, 0x14, + 0x0C, 0x0F, 0x09, 0x1C, 0x06, 0x18, 0x1E, 0x12, + 0x15, 0x00, 0x11, 0x13, 0x0D, 0x01, 0x0B, 0x03, + 0x16, 0x19, 0x05, 0x1D, 0x02, 0x07, 0x04, 0x1B }; + +unsigned char table_45[256] = { + 0x5E, 0xD6, 0xE2, 0x54, 0x35, 0xC2, 0xAC, 0x9D, + 0x92, 0x64, 0x57, 0x65, 0xC8, 0xAE, 0x21, 0xA9, + 0x89, 0x48, 0x12, 0x59, 0xEC, 0xEF, 0x9F, 0xF7, + 0x19, 0x03, 0x83, 0xC0, 0x79, 0x5D, 0x4A, 0x10, + 0x8C, 0xEB, 0xFF, 0xB5, 0x3B, 0x51, 0x2D, 0xD1, + 0x6B, 0xC5, 0x24, 0x5C, 0xE6, 0x11, 0x94, 0x3F, + 0xD0, 0x2F, 0x0E, 0x95, 0x3C, 0xFE, 0x5B, 0x20, + 0x23, 0xE0, 0x91, 0x6F, 0xCA, 0x56, 0x0C, 0x73, + 0xDA, 0x67, 0x37, 0xA3, 0xA5, 0x70, 0x93, 0x1C, + 0x18, 0xD9, 0x42, 0x5F, 0x44, 0xF0, 0xF2, 0x14, + 0x58, 0x8A, 0x1D, 0x40, 0x4E, 0x0B, 0x74, 0x84, + 0x52, 0xCB, 0x60, 0xED, 0xAD, 0x66, 0x43, 0x6C, + 0x81, 0xA1, 0x27, 0xB9, 0xBA, 0x4D, 0xF5, 0x04, + 0xB8, 0x96, 0xA6, 0xA2, 0x7D, 0xD4, 0xEA, 0x45, + 0x4F, 0x55, 0xD3, 0x3E, 0x8E, 0x4C, 0xBF, 0x8B, + 0x9A, 0x06, 0x7A, 0xF4, 0x02, 0x88, 0x80, 0x22, + 0xF3, 0xBD, 0x78, 0xEE, 0xAF, 0xF8, 0x15, 0x09, + 0x0F, 0xB0, 0xDD, 0x99, 0x72, 0xE7, 0x90, 0xE1, + 0x25, 0x62, 0x8D, 0x9C, 0x13, 0x08, 0xC9, 0x28, + 0x2A, 0x47, 0x69, 0xDE, 0x77, 0x87, 0xBB, 0xE9, + 0xAA, 0x33, 0x05, 0x29, 0x34, 0x97, 0xFD, 0xA0, + 0x1E, 0xFC, 0xBE, 0xB1, 0x71, 0x9B, 0x50, 0xDC, + 0xB7, 0x31, 0x63, 0x3A, 0xDF, 0xC3, 0x1B, 0x7C, + 0x0A, 0xD7, 0xF6, 0xDB, 0x49, 0x53, 0x7F, 0xD2, + 0x30, 0xA4, 0xB3, 0x6E, 0xB2, 0x6D, 0xCD, 0x7E, + 0x26, 0xE8, 0x76, 0xCF, 0xE5, 0xCE, 0x16, 0xF1, + 0xC6, 0x68, 0x36, 0x46, 0x1F, 0x38, 0x0D, 0x41, + 0x17, 0xBC, 0x86, 0x9E, 0x6A, 0x7B, 0xB4, 0x01, + 0xCC, 0x2C, 0xE3, 0x5A, 0xB6, 0xFA, 0x00, 0x75, + 0x39, 0xA7, 0xC1, 0xD5, 0x98, 0xAB, 0x1A, 0x85, + 0xD8, 0xE4, 0xC4, 0xA8, 0x4B, 0x61, 0x2E, 0x3D, + 0xF9, 0x2B, 0x32, 0x8F, 0xFB, 0xC7, 0x07, 0x82 }; + +unsigned char table_46[256] = { + 0x85, 0x78, 0xFE, 0x6C, 0x61, 0xA0, 0x71, 0xCC, + 0x45, 0x54, 0x7A, 0xE6, 0x82, 0x1D, 0xA6, 0x02, + 0x47, 0xD0, 0x23, 0x55, 0x62, 0xFA, 0x76, 0x3E, + 0xE3, 0x66, 0x74, 0x10, 0x5D, 0x49, 0x69, 0x0B, + 0x75, 0x12, 0x8D, 0x9F, 0xEE, 0x93, 0x50, 0x70, + 0x32, 0xBC, 0x1E, 0xD3, 0xEF, 0x7B, 0xB4, 0x92, + 0xFD, 0x16, 0xC2, 0xD8, 0xDE, 0x68, 0xD1, 0x64, + 0xC3, 0xA3, 0xB3, 0xC9, 0x08, 0xFB, 0x84, 0xC1, + 0x28, 0x53, 0xCF, 0xD2, 0x35, 0xD7, 0x4A, 0x01, + 0x44, 0xA4, 0x07, 0xAC, 0x98, 0xF1, 0xB2, 0x9A, + 0x94, 0x2D, 0xD4, 0x34, 0x27, 0x60, 0x1A, 0xB9, + 0xAF, 0x89, 0xEB, 0x8F, 0x6A, 0x13, 0x05, 0xF0, + 0x77, 0x5F, 0x4F, 0x58, 0x2C, 0xE7, 0xCE, 0xED, + 0xC0, 0x0D, 0x3A, 0xA7, 0xE2, 0x38, 0x5B, 0xE9, + 0x3D, 0xF2, 0xDF, 0x86, 0xE0, 0x72, 0xF7, 0x88, + 0xAD, 0xB7, 0x11, 0xDB, 0x73, 0x87, 0xC5, 0x22, + 0xE1, 0x5C, 0xD6, 0x57, 0x7E, 0x7D, 0xA2, 0xF9, + 0xF5, 0x9C, 0x25, 0x6F, 0x26, 0x51, 0xC8, 0x80, + 0x2B, 0xA8, 0x19, 0xD9, 0x65, 0xCD, 0x97, 0xEA, + 0xFF, 0x5E, 0x24, 0x3B, 0x4D, 0xB1, 0x1C, 0x79, + 0x39, 0x6B, 0xA5, 0x2A, 0x09, 0xCA, 0x04, 0xEC, + 0xBA, 0x18, 0x31, 0x46, 0x20, 0xBE, 0x1F, 0x3C, + 0x6D, 0xAA, 0xF6, 0xDD, 0xF4, 0x96, 0x03, 0x0A, + 0x9E, 0x83, 0xA1, 0x9D, 0xD5, 0xB0, 0x17, 0xBF, + 0x56, 0xAB, 0xAE, 0x1B, 0x52, 0xC6, 0x81, 0x4B, + 0xDC, 0x90, 0x5A, 0x9B, 0xB6, 0x0F, 0xF3, 0x67, + 0x30, 0x63, 0x7C, 0x40, 0x0E, 0x7F, 0x95, 0x36, + 0xC4, 0x4E, 0x43, 0xCB, 0x15, 0xB8, 0x00, 0x91, + 0x8A, 0x4C, 0x8E, 0x14, 0x06, 0x6E, 0xA9, 0x2E, + 0x3F, 0x48, 0x2F, 0x0C, 0xB5, 0x21, 0xBB, 0xDA, + 0x8B, 0x42, 0x29, 0x8C, 0x33, 0x59, 0xE8, 0xF8, + 0xC7, 0xE4, 0x37, 0xE5, 0xFC, 0xBD, 0x99, 0x41 }; + +unsigned char table_47[32] = { + 0x18, 0x1D, 0x16, 0x10, 0x11, 0x04, 0x1E, 0x08, + 0x19, 0x0E, 0x0F, 0x02, 0x14, 0x1C, 0x07, 0x17, + 0x0D, 0x09, 0x12, 0x1A, 0x05, 0x01, 0x0B, 0x0A, + 0x13, 0x15, 0x0C, 0x00, 0x06, 0x1F, 0x03, 0x1B }; + +unsigned char table_48[32] = { + 0x13, 0x08, 0x15, 0x01, 0x17, 0x10, 0x0F, 0x1F, + 0x1D, 0x0D, 0x12, 0x03, 0x06, 0x0A, 0x1C, 0x19, + 0x1A, 0x04, 0x1B, 0x02, 0x16, 0x1E, 0x11, 0x00, + 0x14, 0x09, 0x0C, 0x18, 0x05, 0x07, 0x0E, 0x0B }; + +unsigned char table_49[32] = { + 0x1F, 0x0F, 0x19, 0x07, 0x18, 0x05, 0x1E, 0x1D, + 0x15, 0x08, 0x17, 0x10, 0x0A, 0x0E, 0x0C, 0x1B, + 0x02, 0x13, 0x03, 0x0D, 0x04, 0x1A, 0x06, 0x09, + 0x12, 0x1C, 0x0B, 0x16, 0x14, 0x01, 0x11, 0x00 }; + +unsigned char table_50[32] = { + 0x16, 0x18, 0x1C, 0x0E, 0x12, 0x00, 0x04, 0x1B, + 0x1F, 0x13, 0x17, 0x0A, 0x1E, 0x03, 0x0C, 0x01, + 0x0F, 0x10, 0x02, 0x08, 0x14, 0x09, 0x19, 0x15, + 0x06, 0x0D, 0x0B, 0x1D, 0x05, 0x07, 0x11, 0x1A }; + +unsigned char table_51[32] = { + 0x1C, 0x0D, 0x1B, 0x07, 0x17, 0x0E, 0x06, 0x01, + 0x12, 0x19, 0x03, 0x0B, 0x10, 0x08, 0x00, 0x1E, + 0x0A, 0x04, 0x1A, 0x1D, 0x0C, 0x18, 0x02, 0x13, + 0x0F, 0x11, 0x05, 0x09, 0x15, 0x16, 0x1F, 0x14 }; + +unsigned char table_52[256] = { + 0x34, 0x0B, 0x47, 0xA3, 0x56, 0x30, 0x73, 0xD4, + 0x4B, 0xF6, 0xA6, 0x80, 0x22, 0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3, 0xF0, 0x5F, 0xFD, 0xCE, 0xD3, 0xCA, 0x39, + 0xD6, 0x79, 0x3D, 0xC8, 0x67, 0x8B, 0x31, 0x4F, + 0xB3, 0xBC, 0x65, 0x00, 0x7A, 0x98, 0xC5, 0x6C, + 0x2B, 0x94, 0x6D, 0x74, 0x14, 0xAC, 0xCC, 0xA0, + 0x5B, 0xF8, 0xCB, 0x7F, 0xB2, 0xEC, 0xBF, 0x3C, + 0xE0, 0xAE, 0xFC, 0x62, 0x04, 0x8E, 0x85, 0x49, + 0x9B, 0xC2, 0x38, 0xD0, 0xEE, 0x81, 0x46, 0xE2, + 0x01, 0x0C, 0x5D, 0x7D, 0xB8, 0xBE, 0x6A, 0x16 }; + +unsigned char table_53[256] = { + 0xE3, 0xF4, 0x8D, 0x72, 0x45, 0x32, 0x9D, 0xCE, + 0x1F, 0x6B, 0xBC, 0xDC, 0xF1, 0xEC, 0x5A, 0x3B, + 0xA5, 0xA2, 0x2B, 0xDD, 0x8A, 0xA3, 0x76, 0xE4, + 0xAF, 0xE9, 0xE1, 0x21, 0xDB, 0x9F, 0x19, 0xD3, + 0x26, 0x80, 0x15, 0xC2, 0x46, 0xB8, 0x17, 0x56, + 0x99, 0x81, 0x08, 0xD7, 0xEF, 0x8E, 0x04, 0x05, + 0x97, 0x2F, 0x78, 0xAD, 0xA1, 0x52, 0x36, 0x58, + 0x53, 0x68, 0x22, 0x70, 0x0B, 0x79, 0xE6, 0xFA, + 0xC3, 0x91, 0xE2, 0xF7, 0xF6, 0x75, 0x2D, 0x0A, + 0x90, 0xEB, 0xA6, 0x35, 0xA7, 0x10, 0xB5, 0xFB, + 0xE7, 0xAA, 0x1E, 0x43, 0xBB, 0x3C, 0x65, 0x25, + 0x2C, 0x59, 0x62, 0x2A, 0xF9, 0x4B, 0x95, 0x5E, + 0x20, 0x11, 0x42, 0x27, 0x44, 0xE8, 0x14, 0x6F, + 0xD1, 0xD8, 0x00, 0x3A, 0x5B, 0x18, 0x89, 0x02, + 0x61, 0xD6, 0xC5, 0x98, 0xD0, 0x5F, 0x34, 0x29, + 0xFD, 0x31, 0x1A, 0xCD, 0x0F, 0x9E, 0xCA, 0x7B, + 0xEA, 0x93, 0x71, 0x5C, 0x0E, 0x57, 0x33, 0xC4, + 0x37, 0xF5, 0x83, 0xB0, 0xDF, 0x49, 0x74, 0x54, + 0x1D, 0x24, 0xB9, 0x16, 0x1C, 0x28, 0xDE, 0x4A, + 0xF0, 0x01, 0x86, 0x82, 0xCC, 0x12, 0x8C, 0x06, + 0x30, 0xA8, 0x7A, 0x73, 0x66, 0x7C, 0xC6, 0xB6, + 0xF2, 0x13, 0xBF, 0x40, 0x85, 0x77, 0x09, 0x3D, + 0x67, 0x63, 0x3F, 0x7F, 0xF3, 0x87, 0x8F, 0xFF, + 0x92, 0xC7, 0x4C, 0x23, 0xBA, 0xCB, 0xB1, 0xED, + 0x0C, 0x60, 0x47, 0xFE, 0x38, 0x5D, 0xCF, 0x8B, + 0x4D, 0xA9, 0x2E, 0xE5, 0xA4, 0x1B, 0x88, 0x3E, + 0x7D, 0xF8, 0xC0, 0xD5, 0x6D, 0x6C, 0x48, 0xAC, + 0x9B, 0x51, 0x7E, 0x6E, 0x50, 0x0D, 0x9A, 0xB3, + 0xEE, 0x07, 0x4F, 0x69, 0x9C, 0x03, 0xD9, 0xD4, + 0xB4, 0xD2, 0xAE, 0x4E, 0x55, 0xB7, 0xC9, 0x41, + 0x39, 0x6A, 0xC8, 0xA0, 0xB2, 0xC1, 0x84, 0xFC, + 0xAB, 0x64, 0xE0, 0xBE, 0xDA, 0xBD, 0x96, 0x94 }; + +unsigned char table_54[32] = { + 0x01, 0x02, 0x1D, 0x10, 0x0E, 0x11, 0x08, 0x14, + 0x12, 0x09, 0x15, 0x17, 0x16, 0x04, 0x06, 0x1B, + 0x07, 0x1A, 0x18, 0x13, 0x0A, 0x1E, 0x1C, 0x1F, + 0x0C, 0x0B, 0x0D, 0x05, 0x0F, 0x00, 0x19, 0x03 }; + +unsigned char table_55[32] = { + 0x01, 0x12, 0x13, 0x09, 0x0B, 0x19, 0x03, 0x0E, + 0x02, 0x1F, 0x1D, 0x1B, 0x1E, 0x11, 0x06, 0x05, + 0x00, 0x16, 0x07, 0x0C, 0x15, 0x0D, 0x1A, 0x08, + 0x18, 0x10, 0x0F, 0x17, 0x1C, 0x0A, 0x04, 0x14 }; + +unsigned char table_56[256] = { + 0xEF, 0x06, 0x5F, 0x11, 0x4B, 0x60, 0x13, 0xBB, + 0x79, 0xD7, 0xE4, 0x6D, 0x22, 0xB4, 0x15, 0x50, + 0x29, 0x17, 0xD2, 0xE3, 0x37, 0x8C, 0x46, 0x7C, + 0xA2, 0xF5, 0x65, 0x16, 0xCB, 0x04, 0x3E, 0xDF, + 0x8E, 0xDE, 0x53, 0xF1, 0xF4, 0xD1, 0x3B, 0xEE, + 0x9A, 0x09, 0x9B, 0x6C, 0xF6, 0xCC, 0xFB, 0x40, + 0xE0, 0xFD, 0x2B, 0x1D, 0x73, 0x18, 0xCD, 0x31, + 0x3F, 0x9E, 0xAD, 0xC9, 0x43, 0x4E, 0x99, 0x3A, + 0x8F, 0x92, 0x85, 0xFC, 0x12, 0x41, 0x20, 0xE8, + 0x2A, 0xC0, 0x1C, 0x38, 0x74, 0x0B, 0xF3, 0x05, + 0x0D, 0x1F, 0x94, 0x9C, 0xAC, 0x00, 0x59, 0x0C, + 0xB3, 0x8D, 0xA8, 0x75, 0xB7, 0x68, 0x2F, 0x27, + 0x6F, 0x69, 0x76, 0xD8, 0xEC, 0xA5, 0xB2, 0x6A, + 0x19, 0x72, 0x1A, 0xB6, 0xE5, 0x77, 0xC6, 0x44, + 0x9D, 0xCA, 0x82, 0x35, 0x36, 0x5E, 0xA9, 0x25, + 0xFA, 0x5C, 0x24, 0x30, 0x39, 0x0E, 0x2C, 0x7D, + 0xE6, 0x88, 0xA0, 0x63, 0xB8, 0x6B, 0x01, 0xDD, + 0xDA, 0x9F, 0x45, 0x83, 0xE2, 0x7F, 0x1B, 0x56, + 0xAF, 0x14, 0xC3, 0x49, 0xBF, 0x78, 0x70, 0x58, + 0x23, 0xA3, 0xBD, 0x34, 0x47, 0x2D, 0x0A, 0xD4, + 0x33, 0x03, 0x1E, 0xC1, 0x87, 0xAE, 0x3C, 0x95, + 0xB0, 0x42, 0x91, 0xB9, 0x5A, 0x61, 0xAA, 0xCF, + 0xF2, 0x51, 0xA6, 0xF8, 0xDC, 0x71, 0xAB, 0x48, + 0x66, 0x90, 0x97, 0xC4, 0x08, 0xF9, 0xD0, 0x7B, + 0xDB, 0xBA, 0x8B, 0xC2, 0xC5, 0x2E, 0xF7, 0x5B, + 0xFF, 0x21, 0x81, 0x54, 0xD3, 0x62, 0x57, 0x4C, + 0x6E, 0x02, 0x98, 0xFE, 0x7E, 0xE7, 0xBC, 0x07, + 0x28, 0x5D, 0x86, 0xCE, 0xEA, 0x84, 0xF0, 0xE1, + 0x93, 0x80, 0xE9, 0xC7, 0x4A, 0xED, 0xB1, 0x26, + 0x89, 0x3D, 0x4F, 0xA7, 0xA1, 0xD6, 0xB5, 0x4D, + 0x67, 0xA4, 0x55, 0x10, 0x0F, 0xD9, 0x52, 0x32, + 0x96, 0xD5, 0xEB, 0x64, 0x8A, 0xC8, 0x7A, 0xBE }; + +unsigned char table_57[256] = { + 0xD1, 0x9B, 0x15, 0x06, 0xB4, 0xF6, 0x97, 0xF0, + 0xC6, 0x5B, 0x88, 0x12, 0x25, 0xFA, 0x7B, 0x79, + 0xD6, 0xAB, 0xDC, 0x47, 0x85, 0x61, 0x67, 0x0B, + 0xF3, 0x20, 0x44, 0x53, 0x2A, 0x3B, 0x2D, 0xE8, + 0x17, 0x71, 0xC3, 0xB7, 0x7F, 0x35, 0xEB, 0x10, + 0x03, 0x0D, 0x60, 0x96, 0x27, 0xBB, 0x39, 0x50, + 0x95, 0x55, 0xCC, 0xD4, 0x2F, 0x51, 0xB3, 0x05, + 0xA5, 0xAD, 0xBC, 0x18, 0xE2, 0xAE, 0x07, 0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 0x02, 0x2B, 0x92, 0x21, 0x7D, 0xF5, 0x5E, + 0x4E, 0x3C, 0x84, 0x14, 0x28, 0x3A, 0xE9, 0xC0 }; + +unsigned char table_58[256] = { + 0xE9, 0x81, 0x60, 0xA7, 0x18, 0xA0, 0x0F, 0x55, + 0x2B, 0x52, 0xE0, 0x8B, 0x9D, 0x85, 0xD2, 0xA3, + 0x3F, 0x6E, 0xB1, 0xAF, 0xE3, 0x36, 0xE2, 0x19, + 0x56, 0xB0, 0x09, 0xB5, 0x79, 0x43, 0xE1, 0x06, + 0x45, 0xB6, 0xC0, 0x22, 0xEE, 0x41, 0xEC, 0x01, + 0x66, 0x2D, 0x87, 0x38, 0x16, 0x37, 0xFA, 0x29, + 0x96, 0xA4, 0xC3, 0x23, 0x59, 0x7E, 0x92, 0x78, + 0x10, 0x2A, 0x4C, 0x0E, 0x9B, 0x4A, 0x35, 0xF4, + 0x42, 0x0C, 0xD8, 0xD7, 0x24, 0x2C, 0xDD, 0x8E, + 0x5B, 0xF5, 0x33, 0x48, 0xEF, 0xDE, 0x4B, 0xBC, + 0x51, 0xAB, 0x7C, 0xE4, 0x63, 0x70, 0x9A, 0xAC, + 0x54, 0x1D, 0x25, 0xC5, 0xEA, 0xB3, 0x05, 0xF7, + 0xC1, 0x1F, 0xE8, 0x97, 0xBB, 0x32, 0x6D, 0xC7, + 0x28, 0x61, 0xDB, 0x4D, 0x77, 0x72, 0x65, 0x8C, + 0x80, 0x3A, 0x76, 0x47, 0xA8, 0x03, 0x04, 0x12, + 0xCE, 0xA9, 0x75, 0x3C, 0x49, 0xF8, 0x64, 0xDF, + 0x57, 0xA2, 0x69, 0x44, 0xAD, 0x3E, 0x4F, 0x0B, + 0x74, 0x67, 0xC9, 0x1A, 0x17, 0xAA, 0x02, 0x6F, + 0xDA, 0xF2, 0xC6, 0x27, 0x53, 0xD6, 0xFD, 0xCA, + 0x8D, 0x93, 0x89, 0xD5, 0x6B, 0x4E, 0x90, 0x82, + 0x30, 0xE7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, + 0x1E, 0x01, 0x9D, 0x44, 0x03, 0xD8, 0x11, 0x53, + 0x4F, 0x6C, 0x8B, 0xB7, 0x40, 0xF2, 0x79, 0x20, + 0x74, 0x97, 0x3E, 0x3D, 0x05, 0xD4, 0x70, 0x30, + 0x54, 0x59, 0xE7, 0x15, 0xE1, 0xEB, 0x71, 0x83, + 0xFE, 0x66, 0xB1, 0xA6, 0xF7, 0x8E, 0x6A, 0xEA, + 0x65, 0x7E, 0xA3, 0xCA, 0x2D, 0x4B, 0xB8, 0x9C, + 0x35, 0xC3, 0xB6, 0x49, 0x32, 0x25, 0xB3, 0xB0, + 0x76, 0xC0, 0xF5, 0x00, 0x8A, 0xAF, 0x19, 0xDB, + 0xDD, 0x47, 0xDC, 0x07, 0xB2, 0x4A, 0x55, 0xE6, + 0x69, 0xEC, 0xED, 0x06, 0x94, 0xB9, 0xA7, 0x56, + 0x2C, 0xAA, 0xE3, 0x22, 0x3B, 0x98, 0x77, 0x52, + 0x3C, 0x64, 0xF8, 0x13, 0x78, 0xFC, 0xFB, 0xF3, + 0xD3, 0xF9, 0x29, 0x45, 0x51, 0x8C, 0xA0, 0x38, + 0xD9, 0xA5, 0x62, 0x3A, 0x6E, 0xD0, 0xE8, 0x7A, + 0x33, 0x1D, 0xB4, 0x73, 0x02, 0xFF, 0x10, 0x80, + 0x6B, 0xF0, 0xA4, 0xBA, 0xF6, 0xC2, 0x0E, 0xE2, + 0x81, 0x43, 0x84, 0x86, 0x1F, 0x31, 0x2F, 0xA9, + 0x1B, 0x2A, 0x4E, 0xF4, 0x95, 0x5B, 0x3F, 0x34, + 0x39, 0x7B, 0x0A, 0x26, 0x6D, 0x57, 0x50, 0x09, + 0x9E, 0xA8, 0xBC, 0x24, 0x93, 0x67, 0x41, 0x96, + 0x0C, 0x46, 0xBD, 0xE9, 0x68, 0x18, 0xAB, 0x2E, + 0x5D, 0x1A, 0x8D, 0xC1, 0x58, 0x48, 0xAD, 0x0F }; + +unsigned char table_60[32] = { + 0x1C, 0x06, 0x1E, 0x10, 0x1D, 0x05, 0x00, 0x0E, + 0x0C, 0x02, 0x11, 0x19, 0x15, 0x18, 0x16, 0x07, + 0x1F, 0x0B, 0x14, 0x01, 0x0F, 0x09, 0x0D, 0x13, + 0x03, 0x08, 0x12, 0x04, 0x1B, 0x0A, 0x17, 0x1A }; + +unsigned char table_61[256] = { + 0xC5, 0xA6, 0xF2, 0x6B, 0x4B, 0x58, 0xE0, 0x41, + 0xC6, 0x2F, 0x13, 0xFE, 0xC1, 0x34, 0x3F, 0x24, + 0x10, 0xBF, 0x8B, 0xC9, 0x26, 0x2E, 0x68, 0xBE, + 0x28, 0x54, 0x93, 0x11, 0x21, 0x03, 0xFF, 0x50, + 0x31, 0x71, 0x2C, 0x6C, 0x91, 0x8F, 0x3B, 0x40, + 0x3E, 0xE5, 0xA5, 0x80, 0xEA, 0x7C, 0x9D, 0x18, + 0x84, 0x5A, 0x73, 0x3A, 0x33, 0x43, 0xA1, 0x47, + 0xB1, 0xEE, 0xFB, 0x79, 0x5E, 0xAF, 0xB9, 0x48, + 0x0F, 0x88, 0x65, 0x67, 0x6F, 0xDB, 0x25, 0xE4, + 0xB0, 0x87, 0xD0, 0x46, 0xB5, 0xB7, 0x53, 0xD4, + 0x1E, 0x76, 0xB4, 0x90, 0xDD, 0xA3, 0xF7, 0x57, + 0xD2, 0xCC, 0x5D, 0xE3, 0xB3, 0xD8, 0x5F, 0x2B, + 0x69, 0x4A, 0x9B, 0x39, 0x1A, 0x8D, 0x05, 0x8A, + 0x44, 0x15, 0xAE, 0xF3, 0xA8, 0x92, 0x02, 0xAB, + 0xB8, 0xDA, 0x0A, 0x0C, 0xED, 0xD7, 0x77, 0x98, + 0x3D, 0x19, 0x95, 0x36, 0xE7, 0x7F, 0x66, 0xEF, + 0x86, 0xDC, 0xCB, 0x9C, 0x63, 0xE6, 0x1D, 0x14, + 0x9A, 0x22, 0xBD, 0xD6, 0x89, 0x2D, 0xD1, 0xF9, + 0xA2, 0xDE, 0xF5, 0x5C, 0x8E, 0x2A, 0x29, 0xCA, + 0x7A, 0x8C, 0x38, 0x9F, 0xBB, 0xDF, 0xEC, 0x30, + 0x00, 0xFC, 0xAC, 0x81, 0xB2, 0xE8, 0xC0, 0xA7, + 0x7B, 0x07, 0x52, 0x74, 0x70, 0x0E, 0x51, 0x6A, + 0x62, 0x0D, 0x85, 0x1B, 0x4F, 0x96, 0x55, 0x1C, + 0x32, 0x6E, 0x01, 0xF6, 0x08, 0xFD, 0x17, 0x35, + 0xF0, 0x16, 0xC8, 0x23, 0xE9, 0x59, 0x3C, 0x37, + 0x5B, 0x42, 0xD3, 0x49, 0x7D, 0x83, 0x78, 0xAD, + 0x94, 0x9E, 0x56, 0xB6, 0xF1, 0xC3, 0x75, 0xF8, + 0xFA, 0x09, 0x4C, 0xD9, 0x97, 0xF4, 0x7E, 0x6D, + 0xBC, 0x4D, 0x64, 0xCD, 0x12, 0x99, 0x45, 0xCE, + 0x61, 0x20, 0x0B, 0xA0, 0x82, 0xD5, 0xE1, 0x72, + 0xA9, 0x1F, 0x06, 0x27, 0xC7, 0x04, 0xE2, 0xBA, + 0xCF, 0x60, 0xAA, 0xA4, 0xEB, 0xC4, 0x4E, 0xC2 }; + +unsigned char table_62[256] = { + 0x01, 0x59, 0xEC, 0xFC, 0x51, 0xD2, 0xE4, 0x9D, + 0xAA, 0x61, 0xD5, 0xCA, 0x63, 0x5D, 0xCE, 0x36, + 0xB9, 0x49, 0x76, 0xA9, 0x14, 0x4C, 0x90, 0x28, + 0x66, 0x17, 0x4F, 0x1E, 0x1A, 0x47, 0x30, 0xE8, + 0xFD, 0x86, 0x2E, 0x7B, 0x7E, 0xCC, 0x34, 0x13, + 0x94, 0x45, 0x38, 0x74, 0x29, 0xB0, 0x37, 0xC3, + 0x26, 0x6C, 0x39, 0xA3, 0x89, 0xEB, 0xA2, 0x20, + 0x00, 0xE0, 0x73, 0xE7, 0xB5, 0xCB, 0xED, 0x3E, + 0x79, 0x09, 0x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7F, 0x24, 0xF8, 0xE3, + 0xCF, 0xE9, 0xDB, 0xD3, 0x02, 0x9A, 0x0E, 0x5F }; + +unsigned char table_63[256] = { + 0x0C, 0x02, 0xEE, 0x94, 0x2D, 0x76, 0x96, 0x75, + 0x21, 0xDC, 0x37, 0x03, 0xC0, 0xF7, 0xDF, 0xEF, + 0xB1, 0x1D, 0xCF, 0x15, 0x5A, 0xB4, 0xCC, 0x81, + 0x89, 0x6B, 0xA5, 0x2E, 0x6D, 0xD4, 0x08, 0x44, + 0x2A, 0x60, 0x50, 0xBF, 0x40, 0x7D, 0x5F, 0x64, + 0x93, 0x70, 0xA4, 0x7F, 0xC9, 0xEB, 0x0A, 0xF8, + 0x9F, 0xA8, 0xBC, 0x25, 0xE5, 0xF3, 0x1B, 0xD7, + 0x29, 0x13, 0x0D, 0x69, 0x20, 0x5C, 0x0F, 0x91, + 0x4F, 0x62, 0x06, 0x26, 0x41, 0xED, 0xDA, 0x53, + 0x65, 0xFF, 0xCD, 0x3F, 0xF6, 0x01, 0xCE, 0xA2, + 0x04, 0xDE, 0x27, 0x87, 0xBA, 0x86, 0x24, 0x78, + 0xAF, 0xE1, 0x3D, 0xD0, 0xC8, 0x1F, 0x4A, 0x2C, + 0x9A, 0xF0, 0xCB, 0xAD, 0x0B, 0x59, 0xC5, 0x58, + 0xEA, 0x8A, 0xA1, 0x45, 0xB7, 0x5D, 0xB5, 0x77, + 0x2B, 0x47, 0x05, 0x00, 0xAC, 0x61, 0xFA, 0x33, + 0x74, 0x31, 0xCA, 0x22, 0x42, 0x8B, 0xFE, 0x09, + 0xB2, 0x6E, 0x1A, 0xBE, 0xAA, 0x7B, 0xEC, 0xF4, + 0x51, 0x66, 0x28, 0x12, 0xFC, 0x5E, 0x67, 0xF5, + 0xB9, 0x82, 0x90, 0x8E, 0x8D, 0x17, 0xE7, 0xE8, + 0xB0, 0xC3, 0x16, 0xA0, 0x4B, 0xB6, 0xFB, 0x7E, + 0xC4, 0x85, 0x4C, 0x1E, 0xC7, 0x39, 0x4E, 0xA9, + 0xE3, 0x4D, 0x32, 0x72, 0x35, 0x80, 0xE0, 0x34, + 0xB8, 0x73, 0x98, 0x49, 0x92, 0x30, 0xD5, 0xD2, + 0xA3, 0x54, 0x7A, 0x84, 0x8F, 0x6C, 0xFD, 0x43, + 0x3A, 0x36, 0x3B, 0xD9, 0x48, 0x6A, 0x14, 0x79, + 0xD1, 0x57, 0x88, 0xDB, 0xE4, 0x9B, 0xF9, 0x99, + 0x10, 0x71, 0xC1, 0x68, 0x9E, 0x11, 0xAB, 0xBD, + 0x7C, 0x3E, 0x3C, 0x18, 0x9D, 0x97, 0xF2, 0xE6, + 0xA6, 0xF1, 0x46, 0xC2, 0x19, 0xBB, 0x52, 0xD8, + 0x95, 0xD3, 0x23, 0xAE, 0x07, 0x2F, 0xE9, 0x63, + 0x1C, 0x55, 0x6F, 0x9C, 0x56, 0x38, 0xC6, 0x5B, + 0x8C, 0xE2, 0x83, 0xA7, 0xD6, 0x0E, 0xB3, 0xDD }; + +unsigned char table_64[32] = { + 0x03, 0x05, 0x0D, 0x09, 0x1A, 0x16, 0x08, 0x10, + 0x06, 0x1E, 0x1C, 0x15, 0x02, 0x04, 0x17, 0x0C, + 0x18, 0x0B, 0x19, 0x11, 0x1B, 0x14, 0x13, 0x0A, + 0x0E, 0x00, 0x1D, 0x1F, 0x01, 0x0F, 0x07, 0x12 }; + +unsigned char table_65[32] = { + 0x01, 0x0A, 0x1E, 0x14, 0x10, 0x1D, 0x0D, 0x17, + 0x0E, 0x0C, 0x0F, 0x12, 0x04, 0x1A, 0x05, 0x02, + 0x08, 0x1C, 0x09, 0x1F, 0x0B, 0x13, 0x19, 0x1B, + 0x11, 0x00, 0x16, 0x06, 0x03, 0x18, 0x15, 0x07 }; + +unsigned char table_66[32] = { + 0x1C, 0x18, 0x0C, 0x09, 0x05, 0x03, 0x15, 0x12, + 0x0D, 0x02, 0x08, 0x0E, 0x19, 0x07, 0x13, 0x17, + 0x1E, 0x1D, 0x1F, 0x11, 0x06, 0x0A, 0x0B, 0x14, + 0x0F, 0x10, 0x01, 0x1B, 0x00, 0x04, 0x1A, 0x16 }; + +unsigned char table_67[256] = { + 0x6B, 0x49, 0xC8, 0x86, 0xFF, 0xC0, 0x5D, 0xEF, + 0xF7, 0x06, 0xE0, 0x98, 0xA9, 0x72, 0x71, 0xD5, + 0xBA, 0x7F, 0x10, 0xD1, 0xBE, 0x41, 0x9C, 0x40, + 0x28, 0x8E, 0xE5, 0x74, 0x47, 0x9E, 0x3E, 0x7C, + 0xB5, 0xCD, 0x3F, 0x20, 0xF2, 0xA6, 0xDC, 0x97, + 0x32, 0x6D, 0x52, 0xF5, 0x16, 0x05, 0xFE, 0x04, + 0x3D, 0x53, 0x50, 0x23, 0x39, 0x77, 0x08, 0x60, + 0x75, 0x18, 0x4A, 0xC6, 0xBB, 0xE7, 0xF1, 0xAB, + 0xEB, 0x88, 0xB6, 0x82, 0x6E, 0x91, 0xF3, 0x34, + 0x3A, 0x42, 0x1A, 0xDF, 0xA1, 0xB3, 0x92, 0xBF, + 0xB7, 0x00, 0xD4, 0xDE, 0x31, 0xF0, 0x1C, 0xDA, + 0x4F, 0x61, 0x67, 0x2C, 0x07, 0xF9, 0x15, 0xA4, + 0x7A, 0x26, 0x45, 0x2A, 0x12, 0x9F, 0xF4, 0x14, + 0x8C, 0x90, 0xFC, 0xC5, 0x4B, 0x87, 0xE2, 0xC7, + 0xD0, 0x8A, 0xE8, 0xDD, 0xEE, 0x3C, 0x2F, 0x22, + 0x6A, 0x54, 0x37, 0x9B, 0x84, 0x25, 0x8F, 0xE3, + 0xD7, 0xD8, 0x4E, 0xAD, 0x0F, 0x4C, 0x56, 0xA2, + 0xD3, 0xB0, 0x73, 0x0B, 0xAE, 0xEA, 0x1D, 0x01, + 0x36, 0xB4, 0x2D, 0xC4, 0x19, 0x58, 0x1E, 0x62, + 0xE9, 0xB2, 0x5B, 0x5A, 0xBD, 0xD6, 0x65, 0x94, + 0x9A, 0x55, 0xCC, 0x99, 0x1B, 0x85, 0x2B, 0xBC, + 0x8D, 0x46, 0x81, 0xB8, 0xA3, 0x29, 0x5F, 0x35, + 0x5C, 0xB1, 0x1F, 0x13, 0x17, 0xCB, 0x51, 0x02, + 0x09, 0x7E, 0xA7, 0x69, 0x6F, 0x95, 0x30, 0x7B, + 0xCA, 0x48, 0xAF, 0xAA, 0x0E, 0x44, 0x38, 0xB9, + 0x0D, 0x11, 0xA0, 0xD9, 0x0C, 0xDB, 0xF8, 0x68, + 0x33, 0x79, 0x59, 0x66, 0x4D, 0x03, 0xE1, 0x89, + 0xE4, 0x3B, 0x78, 0xC2, 0x64, 0x6C, 0x27, 0xC9, + 0xCF, 0xAC, 0xED, 0xFA, 0x5E, 0x2E, 0x76, 0x57, + 0x93, 0xEC, 0x80, 0xA8, 0xE6, 0xCE, 0xC1, 0xA5, + 0x9D, 0xD2, 0xC3, 0x0A, 0x7D, 0x70, 0xF6, 0x63, + 0x24, 0x43, 0x21, 0x83, 0xFB, 0xFD, 0x8B, 0x96 }; + +unsigned char table_68[256] = { + 0x93, 0xFF, 0x83, 0x70, 0x12, 0x2D, 0x1C, 0xD6, + 0xF9, 0xEE, 0xCF, 0x94, 0x7B, 0xB5, 0xA4, 0x84, + 0x99, 0xF7, 0x67, 0x32, 0xFC, 0x8A, 0xE3, 0xE4, + 0xCE, 0xC6, 0x77, 0x7E, 0xDA, 0x42, 0x85, 0xF0, + 0x7D, 0x48, 0x28, 0x79, 0xDE, 0x5B, 0xE2, 0x0F, + 0x75, 0xC5, 0x2C, 0x4F, 0xF3, 0xEC, 0x14, 0x10, + 0x9C, 0x6E, 0x59, 0x4A, 0x20, 0x34, 0xA3, 0x89, + 0xE0, 0x4E, 0x52, 0x88, 0x81, 0x5F, 0x6F, 0x71, + 0x17, 0x3B, 0x21, 0xB4, 0xCB, 0x9B, 0x18, 0x13, + 0xE8, 0xE1, 0x02, 0x2E, 0xED, 0x00, 0xA7, 0x1B, + 0x06, 0xF4, 0x27, 0xDC, 0x35, 0x2F, 0x08, 0x9D, + 0x7C, 0xC0, 0x36, 0xA6, 0x6B, 0xDF, 0x4C, 0xBC, + 0xFE, 0xDB, 0xA5, 0xA8, 0x8D, 0x73, 0x7F, 0xC7, + 0x8E, 0x60, 0x31, 0x61, 0x4B, 0x29, 0xD7, 0xE9, + 0xBD, 0xAB, 0xCC, 0xFA, 0xD9, 0xEF, 0xC2, 0xD4, + 0x19, 0x11, 0x15, 0xC9, 0xB1, 0xD5, 0x64, 0x97, + 0xE7, 0x8F, 0x05, 0x44, 0xF8, 0xF1, 0x58, 0x47, + 0x2A, 0x03, 0x1F, 0xAF, 0x0D, 0x04, 0x23, 0xB8, + 0x24, 0x51, 0xB2, 0x54, 0x41, 0x53, 0x5C, 0xAE, + 0xB7, 0xB3, 0xB6, 0x3D, 0x37, 0x39, 0x55, 0xBF, + 0x0B, 0x7A, 0x57, 0x3C, 0x0E, 0x40, 0x6A, 0xF5, + 0x72, 0xDD, 0xBB, 0x8B, 0xAA, 0x46, 0xA0, 0x30, + 0x56, 0x78, 0x38, 0xBA, 0x9E, 0x92, 0x87, 0xFB, + 0x66, 0x90, 0x1E, 0xB9, 0x96, 0x65, 0xA2, 0x50, + 0x1D, 0xC3, 0x26, 0x22, 0xD0, 0x0A, 0x43, 0xF2, + 0xB0, 0xEB, 0xAC, 0x62, 0x98, 0x3F, 0xD3, 0x69, + 0xA1, 0x9F, 0x16, 0x95, 0xE6, 0xF6, 0x2B, 0x25, + 0x1A, 0xD2, 0xBE, 0x09, 0x5D, 0x45, 0xC4, 0xFD, + 0x5A, 0x07, 0x0C, 0x82, 0x3E, 0x49, 0x74, 0x6C, + 0x68, 0x5E, 0xCA, 0xEA, 0xCD, 0x9A, 0xAD, 0xD1, + 0x33, 0x86, 0x76, 0x80, 0xE5, 0xC8, 0xD8, 0xA9, + 0x8C, 0x6D, 0x91, 0x63, 0x3A, 0x4D, 0xC1, 0x01 }; + +unsigned char table_69[256] = { + 0x21,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 0x2D, 0x3F, 0xDF, 0x07, 0x5B, + 0xAE, 0x47, 0x61, 0x08, 0x18, 0xDB, 0x6D, 0x3C, + 0x96, 0xD5, 0xAB, 0x78, 0x94, 0x45, 0x20, 0x9A, + 0xE4, 0x13, 0x68, 0xDD, 0xDE, 0x31, 0x14, 0x57, + 0x02, 0x52, 0x56, 0x1C, 0x1B, 0xE9, 0xD0, 0xA1, + 0x22, 0x64, 0xB2, 0x7A, 0xCF, 0x5D, 0x00, 0x0F, + 0xF8, 0x5E, 0x36, 0x58, 0x40, 0xAF, 0x19, 0x32, + 0x2E, 0xB3, 0x72, 0xBE, 0xB9, 0xD3, 0xCD, 0x7D, + 0x4A, 0x1D, 0x33, 0x2F, 0xAC, 0x27, 0x41, 0xE8, + 0x55, 0xCB, 0x0E, 0x5A, 0x77, 0xFB, 0x8B, 0x86, + 0x75, 0x8A, 0x51, 0xEC, 0xDA, 0xC6, 0xA6, 0xCC, + 0x91, 0x4B, 0x11, 0xF6, 0xEA, 0xD1, 0xB6, 0x4E, + 0x82, 0x04, 0x92, 0x30, 0xF4, 0x25, 0x88, 0x1E, + 0x9C, 0xA0, 0xC8, 0x6A, 0x93, 0x87, 0x1F, 0xB4, + 0xB1, 0x8F, 0x65, 0xCA, 0xFE, 0xFF, 0x97, 0x15, + 0x99, 0x28, 0x80, 0x42, 0x70, 0x85, 0x0C, 0x3B, + 0xBD, 0xE1, 0xA7, 0x17, 0xC9, 0x3A, 0xBB, 0x6B, + 0x37, 0xF0, 0xC5, 0x39, 0x6F, 0x01, 0x83, 0x67, + 0x74, 0xCE, 0xDC, 0x90, 0x3E, 0xF3, 0x7F, 0xC4, + 0x49, 0x84, 0x38, 0xC7, 0xE3, 0xD4, 0x1A, 0xBF }; + +unsigned char table_71[32] = { + 0x17, 0x13, 0x0E, 0x1A, 0x0D, 0x18, 0x19, 0x10, + 0x14, 0x11, 0x16, 0x05, 0x04, 0x00, 0x12, 0x0A, + 0x02, 0x07, 0x03, 0x0B, 0x09, 0x1F, 0x1C, 0x0F, + 0x0C, 0x06, 0x1B, 0x08, 0x1D, 0x01, 0x15, 0x1E }; + +unsigned char table_72[256] = { + 0xC9, 0xA7, 0x1B, 0xEC, 0x2B, 0x8B, 0xB0, 0xEB, + 0x7F, 0x39, 0x25, 0xD9, 0x1D, 0xD5, 0x67, 0xA0, + 0xB3, 0xAC, 0x3B, 0xC8, 0x82, 0xC0, 0xE3, 0x9E, + 0x4C, 0x9B, 0xAF, 0xFD, 0x91, 0x86, 0x5F, 0x92, + 0xB4, 0x42, 0x3C, 0x45, 0x12, 0xC4, 0xE2, 0xE1, + 0x6C, 0x1F, 0xC6, 0x40, 0x93, 0x2A, 0xC2, 0x72, + 0x2E, 0x14, 0x51, 0xA5, 0x70, 0xBD, 0xA2, 0xC7, + 0x7D, 0xF1, 0x9F, 0x64, 0xC1, 0xF7, 0x80, 0xFF, + 0x50, 0x49, 0x8C, 0x66, 0x13, 0x48, 0x6A, 0x0A, + 0x26, 0x94, 0x83, 0x1E, 0x84, 0xBB, 0x57, 0x27, + 0x44, 0x5B, 0x62, 0xF6, 0x09, 0x4F, 0x77, 0x76, + 0x2D, 0x7E, 0xCD, 0x0B, 0x24, 0xFE, 0x81, 0xB8, + 0x21, 0x85, 0xCF, 0xA8, 0x75, 0x56, 0x37, 0x17, + 0xAA, 0x23, 0xE5, 0xE8, 0x9A, 0x9D, 0x2F, 0x04, + 0x31, 0x4A, 0x7C, 0xFC, 0xD6, 0xE4, 0x29, 0xC3, + 0xFB, 0x36, 0x1C, 0x0C, 0xCE, 0xEE, 0x0D, 0xF3, + 0x46, 0xF8, 0x41, 0x0E, 0x68, 0xAB, 0x2C, 0x69, + 0x96, 0x90, 0x28, 0xED, 0x02, 0x63, 0x07, 0xAD, + 0xB2, 0xDC, 0x05, 0xE6, 0x78, 0x03, 0xA4, 0x7A, + 0x5C, 0x52, 0x95, 0x5D, 0x88, 0x01, 0xDF, 0x35, + 0x5E, 0xB6, 0x06, 0x4D, 0x15, 0x89, 0x59, 0x3F, + 0xF0, 0xA1, 0xA3, 0x99, 0x19, 0xEA, 0xDB, 0xE0, + 0x6B, 0x71, 0x6E, 0xB7, 0x65, 0x54, 0x9C, 0xBC, + 0x98, 0xDD, 0x4B, 0x60, 0x3D, 0xBF, 0xF5, 0xD1, + 0xD7, 0xF9, 0x55, 0x61, 0xA9, 0xB1, 0x6D, 0xDE, + 0x79, 0xAE, 0x1A, 0x34, 0x3A, 0x4E, 0xCB, 0x38, + 0xBA, 0x97, 0x00, 0x74, 0xEF, 0xD8, 0x18, 0x33, + 0x7B, 0xFA, 0x22, 0x32, 0x20, 0xCA, 0x8A, 0xBE, + 0xA6, 0x43, 0x11, 0x10, 0xD0, 0xD3, 0x87, 0x73, + 0x6F, 0xF4, 0x8D, 0xCC, 0x30, 0x0F, 0x16, 0xDA, + 0xB5, 0xC5, 0xD4, 0x47, 0x8E, 0xE7, 0x58, 0x8F, + 0x08, 0x53, 0xF2, 0xB9, 0x5A, 0x3E, 0xE9, 0xD2 }; + +unsigned char table_73[256] = { + 0x36, 0x37, 0xED, 0xD8, 0xBF, 0xD7, 0x12, 0xB7, + 0x40, 0x32, 0x19, 0x4A, 0x44, 0x2A, 0xCE, 0xA5, + 0x29, 0x13, 0x43, 0x51, 0x5C, 0xD0, 0x76, 0x6E, + 0x41, 0xD6, 0xE2, 0x4F, 0xB8, 0x27, 0x2E, 0xCF, + 0xD9, 0xE0, 0x69, 0xC0, 0x59, 0x77, 0x62, 0x6F, + 0x53, 0xE7, 0x93, 0xD4, 0xAD, 0xC8, 0x4C, 0xC2, + 0x2C, 0xBE, 0xAA, 0xA0, 0x22, 0x78, 0x14, 0xB3, + 0xB0, 0xEA, 0xBA, 0x9A, 0x33, 0x1B, 0x31, 0x6C, + 0xFC, 0x0A, 0x0B, 0xA1, 0xE4, 0x75, 0x7C, 0xE3, + 0x65, 0x21, 0xA9, 0xA4, 0x4E, 0x3C, 0x5F, 0x39, + 0x74, 0xA2, 0x9E, 0x03, 0x70, 0xD2, 0xFD, 0x1D, + 0x25, 0x72, 0x73, 0x8E, 0x7B, 0xB2, 0x6A, 0x92, + 0x81, 0xF3, 0xF0, 0x46, 0x08, 0x85, 0xE6, 0x30, + 0x05, 0x7E, 0xEC, 0x0D, 0xDD, 0x42, 0x2F, 0x5B, + 0xB9, 0xCB, 0x84, 0x0C, 0x16, 0xC7, 0x24, 0xFA, + 0xF9, 0x8F, 0x20, 0xAC, 0x10, 0x55, 0xC3, 0x1A, + 0x8B, 0x94, 0x3D, 0xDB, 0xC9, 0x04, 0xB5, 0xCC, + 0xC6, 0x98, 0xB6, 0x8D, 0x0F, 0x3A, 0x06, 0x4B, + 0xEF, 0x35, 0x68, 0x3F, 0xEE, 0xE5, 0x63, 0xC5, + 0x60, 0x88, 0x52, 0x2D, 0x6D, 0xAB, 0xCD, 0xC4, + 0x1F, 0xF4, 0xCA, 0x67, 0x7D, 0x1C, 0xDA, 0x34, + 0xDE, 0x86, 0xAE, 0xF1, 0x61, 0x09, 0xF5, 0xF6, + 0x49, 0xE9, 0xF2, 0x48, 0x1E, 0xD3, 0x56, 0x18, + 0x9B, 0xB1, 0x57, 0x9D, 0xBB, 0x5E, 0xAF, 0x87, + 0x9F, 0x8A, 0xC1, 0x79, 0xA7, 0xA8, 0xFB, 0xDC, + 0x47, 0x3E, 0x97, 0x80, 0x91, 0xA6, 0x7A, 0xA3, + 0x9C, 0x11, 0x02, 0x2B, 0x58, 0xD1, 0xF7, 0x00, + 0x83, 0x01, 0xE8, 0xFE, 0x50, 0x23, 0x66, 0x4D, + 0xD5, 0x82, 0x89, 0x3B, 0xEB, 0xE1, 0xF8, 0x5A, + 0x15, 0x7F, 0x8C, 0x17, 0x96, 0x28, 0x5D, 0x64, + 0x26, 0x38, 0x71, 0x0E, 0x45, 0xDF, 0xB4, 0x99, + 0xFF, 0x90, 0x6B, 0xBC, 0x54, 0x95, 0xBD, 0x07 }; + +unsigned char table_74[256] = { + 0xA7, 0xCF, 0x99, 0x1A,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, 0x18, + 0x32, 0x0B, 0x7F, 0x44, 0xB4, 0xAF, 0xF2, 0xEB, + 0x22, 0xFD, 0x14, 0xA0, 0xFE, 0x8B, 0xB9, 0x16, + 0x86, 0xE3, 0xD7, 0xDA, 0xC5, 0x3A, 0x41, 0x83, + 0xD1, 0x28, 0x54, 0x30, 0xE0, 0x40, 0xA5, 0x57, + 0x8F, 0x84, 0xD6, 0x96, 0x39, 0xE5, 0x42, 0x80, + 0xA9, 0x58, 0xCE, 0x5D, 0xEE, 0x5F, 0xA3, 0xD0, + 0xC8, 0x59, 0x43, 0x4D, 0x5C, 0xF7, 0xCC, 0x76, + 0x6E, 0xF3, 0x23, 0x3D, 0x85, 0x82, 0x78, 0xF6, + 0x2F, 0xD8, 0xC3, 0x7C, 0x9C, 0x98, 0xEA, 0x71 }; + +unsigned char table_75[256] = { + 0xE7, 0xA5, 0x30, 0xE1, 0x9D, 0x81, 0xBE, 0x83, + 0xB2, 0x1E, 0xE4, 0x69, 0x2F, 0x2B, 0x0D, 0xEB, + 0x7C, 0x59, 0x2D, 0xAA, 0x01, 0x0C, 0xDB, 0xED, + 0xC4, 0xEE, 0x5D, 0x38, 0x72, 0xD8, 0x70, 0xCE, + 0x0B, 0xF6, 0x7F, 0x48, 0x26, 0x9E, 0xA3, 0x44, + 0xD6, 0xCF, 0x0F, 0x6B, 0xFD, 0x23, 0x98, 0xAB, + 0x11, 0xD4, 0x92, 0x91, 0x5E, 0x08, 0x4D, 0xC6, + 0xF0, 0xA8, 0x7E, 0x8A, 0x1D, 0xA1, 0x97, 0x76, + 0x3E, 0x64, 0x07, 0x24, 0xDE, 0x75, 0xA4, 0xCC, + 0x1A, 0x04, 0x4B, 0x6C, 0xFA, 0xB0, 0xC7, 0x35, + 0xE2, 0x56, 0x61, 0xA0, 0xE9, 0x27, 0xDF, 0xC3, + 0xE5, 0xF4, 0x8D, 0xB4, 0xD3, 0x52, 0xD7, 0x49, + 0xCD, 0x31, 0x6E, 0x3F, 0x4E, 0x6A, 0x5B, 0x65, + 0xCA, 0x14, 0x71, 0x53, 0xD9, 0x47, 0x28, 0x7D, + 0x17, 0x06, 0x5C, 0xFE, 0xBA, 0xB8, 0xAC, 0x15, + 0xE8, 0xE0, 0x9A, 0xDD, 0x1F, 0xBC, 0x95, 0x42, + 0xCB, 0x58, 0x00, 0x85, 0xD5, 0x62, 0xC9, 0xB6, + 0x05, 0x80, 0x4C, 0x3C, 0x1C, 0xF5, 0x03, 0xF8, + 0x96, 0x77, 0x02, 0x19, 0xF2, 0xFB, 0x5F, 0xC2, + 0xAE, 0x60, 0x1B, 0xAD, 0x8F, 0xC1, 0x33, 0xA6, + 0x20, 0xBF, 0xA7, 0xC8, 0x74, 0x18, 0x90, 0xE3, + 0x68, 0x09, 0x7A, 0x79, 0xB5, 0xDA, 0xF3, 0x0E, + 0x66, 0x84, 0xB3, 0xBB, 0xE6, 0xF7, 0xB7, 0x7B, + 0x39, 0x4A, 0x12, 0x4F, 0xC5, 0x41, 0x54, 0xD0, + 0xFF, 0x87, 0x63, 0x40, 0x99, 0x21, 0x29, 0xD2, + 0x3D, 0x37, 0x3A, 0x93, 0xFC, 0x25, 0xF1, 0xD1, + 0x2C, 0x6D, 0x8C, 0x5A, 0x8E, 0x9B, 0xBD, 0xAF, + 0x10, 0x55, 0xF9, 0x9F, 0x43, 0x0A, 0x50, 0x16, + 0x57, 0xB1, 0xC0, 0x73, 0x82, 0xEF, 0x88, 0x6F, + 0xEA, 0x2A, 0xEC, 0x2E, 0x86, 0x45, 0x51, 0x22, + 0xA9, 0x34, 0x94, 0x3B, 0xB9, 0x9C, 0xA2, 0x13, + 0x89, 0x46, 0x78, 0xDC, 0x32, 0x8B, 0x67, 0x36 }; + +unsigned char table_76[256] = { + 0x3D, 0x66, 0x40, 0xC5, 0x1D, 0xF5, 0xE7, 0xB7, + 0x2C, 0x23, 0x09, 0xC2, 0x68, 0xE6, 0xD3, 0x8D, + 0x35, 0x94, 0x93, 0xF0, 0x43, 0x97, 0x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 0x1F, 0x9D, 0xBA, 0x29, 0x4D, 0xF8, 0xDF, + 0xC4, 0x72, 0x2F, 0xAE, 0x06, 0x51, 0x41, 0xAF, + 0xF3, 0xDD, 0x87, 0xB2, 0x9C, 0xC7, 0x12, 0x16, + 0x20, 0xA7, 0x21, 0x73, 0xF1, 0x58, 0xD7, 0x7B, + 0xB9, 0xB3, 0x32, 0x01, 0x80, 0x1C, 0x39, 0x0B, + 0x13, 0x56, 0x6C, 0x89, 0x33, 0x6E, 0x2A, 0xA5, + 0xD1, 0x95, 0xC3, 0xA0, 0x0F, 0xCA, 0xAC, 0xFC }; + +unsigned char table_77[32] = { + 0x1C, 0x0D, 0x1E, 0x01, 0x06, 0x16, 0x18, 0x17, + 0x0B, 0x1F, 0x04, 0x0F, 0x00, 0x19, 0x08, 0x0A, + 0x11, 0x03, 0x05, 0x07, 0x09, 0x0C, 0x15, 0x14, + 0x1A, 0x12, 0x13, 0x0E, 0x1D, 0x10, 0x02, 0x1B }; + +unsigned char table_78[32] = { + 0x0E, 0x02, 0x17, 0x12, 0x1E, 0x09, 0x15, 0x03, + 0x01, 0x0B, 0x0F, 0x11, 0x10, 0x0A, 0x16, 0x06, + 0x07, 0x00, 0x1C, 0x1D, 0x1F, 0x0C, 0x18, 0x04, + 0x13, 0x0D, 0x1B, 0x08, 0x19, 0x14, 0x05, 0x1A }; + +unsigned char table_79[32] = { + 0x12, 0x0B, 0x11, 0x01, 0x07, 0x0E, 0x1A, 0x0D, + 0x1E, 0x18, 0x14, 0x1F, 0x0A, 0x17, 0x19, 0x1B, + 0x00, 0x10, 0x0C, 0x08, 0x13, 0x02, 0x0F, 0x1D, + 0x09, 0x06, 0x04, 0x16, 0x15, 0x1C, 0x05, 0x03 }; + +unsigned char table_80[256] = { + 0x14, 0xE7, 0x31, 0x0F, 0xD1, 0x5F, 0xED, 0x1E, + 0xA6, 0x77, 0x20, 0x57, 0x34, 0x64, 0x33, 0x0B, + 0x5A, 0xB4, 0x83, 0x62, 0xF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C, 0xA0, + 0xDD, 0x66, 0x10, 0xA2, 0xDF, 0x30, 0xF4, 0x88, + 0xCB, 0x36, 0x82, 0xE3, 0x73, 0x17, 0x55, 0x15, + 0xF5, 0xB7, 0x23, 0xB1, 0xD6, 0xE2, 0x47, 0x7E, + 0x67, 0xE8, 0x1D, 0x16, 0x8B, 0xEB, 0xD0, 0x3D, + 0x6A, 0x54, 0x2A, 0x4E, 0x93, 0xFA, 0x44, 0x05, + 0x2F, 0x50, 0x2E, 0x95, 0xAE, 0x1B, 0x56, 0x7B, + 0x39, 0xB9, 0xC0, 0x22, 0xF1, 0x4D, 0x90, 0xFC }; + +unsigned char table_81[32] = { + 0x03, 0x02, 0x1D, 0x0E, 0x09, 0x1A, 0x0C, 0x11, + 0x1C, 0x0D, 0x08, 0x12, 0x19, 0x10, 0x04, 0x17, + 0x15, 0x05, 0x0A, 0x00, 0x13, 0x16, 0x1B, 0x18, + 0x1E, 0x0B, 0x0F, 0x01, 0x07, 0x14, 0x1F, 0x06 }; + +unsigned char table_82[256] = { + 0x53, 0xD3, 0x64, 0x89, 0x7D, 0xA5, 0x66, 0xA4, + 0x09, 0x46, 0x17, 0x2C, 0xAF, 0x8C, 0x21, 0x5F, + 0x3B, 0x22, 0xE3, 0x05, 0x07, 0x28, 0x2F, 0xAB, + 0xF4, 0x8E, 0x51, 0x31, 0x02, 0xC7, 0x48, 0x13, + 0x24, 0x12, 0xB8, 0xE5, 0xBD, 0xAE, 0x7E, 0xCC, + 0xC9, 0x98, 0x08, 0xEE, 0xDB, 0x1B, 0xE8, 0x3D, + 0x8F, 0xF2, 0xFB, 0x36, 0x4D, 0x94, 0x9C, 0x16, + 0xF7, 0x42, 0x9B, 0x2B, 0xFD, 0x7B, 0x77, 0x3F, + 0xC3, 0xFC, 0x23, 0x93, 0x50, 0x0C, 0x79, 0x18, + 0x47, 0xE1, 0xCB, 0xA7, 0xB6, 0x85, 0xE6, 0x61, + 0x2D, 0xD8, 0x9F, 0x80, 0xE9, 0x14, 0x0B, 0x1C, + 0x40, 0x76, 0x2A, 0x25, 0x0E, 0x99, 0xAC, 0xC4, + 0xEB, 0x29, 0x41, 0x8A, 0x73, 0x06, 0x57, 0xC6, + 0x8D, 0xFA, 0x5A, 0xCD, 0x67, 0xB2, 0xD9, 0x0A, + 0x1E, 0xEF, 0x3E, 0xA0, 0x45, 0x03, 0x27, 0xF1, + 0x38, 0x54, 0xC1, 0x7A, 0xFE, 0x52, 0x75, 0xD4, + 0x74, 0x7C, 0xD2, 0x68, 0xEA, 0x4C, 0x97, 0xF9, + 0xF5, 0x8B, 0x0F, 0x84, 0xA8, 0x6E, 0x9E, 0x11, + 0x6B, 0xBC, 0x4B, 0x6C, 0x9A, 0xF0, 0xA3, 0x1F, + 0x92, 0x19, 0xA2, 0x3A, 0x15, 0x04, 0xC5, 0x62, + 0xD5, 0x96, 0x90, 0x32, 0xAA, 0xD6, 0xCF, 0x35, + 0xB4, 0x81, 0x2E, 0x01, 0x10, 0x49, 0x70, 0xDE, + 0xDD, 0x88, 0xB9, 0x6D, 0x60, 0xBB, 0x44, 0xF8, + 0x3C, 0xEC, 0x34, 0x82, 0x95, 0x72, 0x58, 0x4E, + 0xE4, 0x0D, 0xBE, 0xDA, 0x83, 0x4A, 0x00, 0xBF, + 0xD0, 0xC8, 0x26, 0xB3, 0x65, 0x1A, 0x69, 0xCA, + 0xF3, 0xD7, 0x6F, 0x55, 0xE2, 0xFF, 0x5D, 0xDC, + 0x20, 0xF6, 0x63, 0xED, 0xE0, 0x59, 0x9D, 0xB1, + 0x1D, 0xAD, 0x91, 0xA1, 0xB7, 0xA9, 0xDF, 0xC0, + 0x39, 0xD1, 0x43, 0xCE, 0x4F, 0x5C, 0xE7, 0x37, + 0x5E, 0x33, 0x5B, 0xA6, 0xC2, 0xB0, 0xBA, 0x30, + 0x6A, 0x78, 0xB5, 0x71, 0x56, 0x87, 0x7F, 0x86 }; + +unsigned char table_83[32] = { + 0x1B, 0x0A, 0x1F, 0x01, 0x10, 0x08, 0x0E, 0x18, + 0x06, 0x04, 0x00, 0x1C, 0x0C, 0x19, 0x0D, 0x16, + 0x02, 0x03, 0x09, 0x07, 0x13, 0x0F, 0x05, 0x12, + 0x17, 0x1E, 0x1A, 0x1D, 0x0B, 0x11, 0x14, 0x15 }; + +unsigned char table_84[32] = { + 0x02, 0x1A, 0x0D, 0x15, 0x01, 0x16, 0x1E, 0x00, + 0x08, 0x1B, 0x04, 0x10, 0x1C, 0x18, 0x19, 0x14, + 0x0C, 0x11, 0x0B, 0x0E, 0x03, 0x0A, 0x07, 0x12, + 0x1D, 0x17, 0x13, 0x06, 0x0F, 0x05, 0x09, 0x1F }; + +unsigned char table_85[256] = { + 0xC6, 0x7C, 0xCE, 0xBD, 0x84, 0x3E, 0x0B, 0xD8, + 0xFE, 0xCC, 0x46, 0x50, 0xD1, 0xFB, 0xA0, 0x6D, + 0xEA, 0xE2, 0x40, 0x51, 0x13, 0xB0, 0xD6, 0xB1, + 0xA8, 0xDF, 0x61, 0xA4, 0x80, 0x21, 0xB3, 0x33, + 0x06, 0x6B, 0xE3, 0x8C, 0xA1, 0x18, 0xBA, 0x03, + 0xD7, 0x8D, 0x54, 0x12, 0x4C, 0xEE, 0x9E, 0xCF, + 0x04, 0x2A, 0x08, 0xBB, 0xC2, 0xD4, 0xC3, 0x4A, + 0xD5, 0xFA, 0x36, 0x2F, 0x14, 0x3F, 0xED, 0x05, + 0x17, 0x28, 0x75, 0xFC, 0xA2, 0x1F, 0x4B, 0x6F, + 0x91, 0x7E, 0x4E, 0x96, 0x3B, 0xF3, 0x1D, 0x78, + 0xEB, 0x68, 0xF1, 0xA7, 0x9F, 0xC7, 0x59, 0x6C, + 0x92, 0xE6, 0x66, 0x07, 0x8A, 0x25, 0x26, 0x72, + 0x30, 0x5A, 0x81, 0x2C, 0x58, 0x32, 0xCB, 0xE0, + 0xF9, 0x48, 0x83, 0x9B, 0xA5, 0xE1, 0xA6, 0x64, + 0xFF, 0xC9, 0x8F, 0x53, 0x3D, 0x24, 0xC8, 0xDE, + 0x02, 0x7D, 0x09, 0xB4, 0x0A, 0x95, 0x0F, 0xE4, + 0xDB, 0xB7, 0x71, 0x4D, 0x1C, 0xAC, 0x35, 0xCD, + 0x29, 0xDD, 0xC1, 0xF2, 0xF4, 0xC0, 0x5C, 0x74, + 0xDC, 0x87, 0xFD, 0x4F, 0x11, 0x0E, 0x5D, 0x3C, + 0x01, 0x73, 0xE9, 0xD9, 0x10, 0x9A, 0x5B, 0xC5, + 0x98, 0x34, 0x15, 0xAE, 0xF7, 0xAA, 0x67, 0x23, + 0xBC, 0x8B, 0x7B, 0x65, 0xA9, 0xB6, 0x77, 0x00, + 0x19, 0x0C, 0x5E, 0x99, 0xF0, 0x55, 0x86, 0x97, + 0x69, 0xDA, 0x38, 0x9C, 0x16, 0xE8, 0x27, 0xAF, + 0x2E, 0x47, 0x6A, 0xD0, 0x79, 0x44, 0x45, 0x2B, + 0x5F, 0x85, 0xF5, 0x62, 0x70, 0x22, 0x7F, 0xF6, + 0x88, 0x93, 0x60, 0x42, 0x3A, 0x39, 0x49, 0x6E, + 0x89, 0x52, 0x20, 0xF8, 0xCA, 0xD2, 0x76, 0xB9, + 0xAB, 0x7A, 0x9D, 0xD3, 0xBE, 0x1A, 0xAD, 0x41, + 0x56, 0x31, 0x90, 0xB5, 0xB2, 0xEC, 0xA3, 0xE5, + 0x8E, 0x1B, 0xEF, 0xBF, 0x94, 0xC4, 0x0D, 0xB8, + 0x2D, 0x57, 0xE7, 0x82, 0x1E, 0x37, 0x63, 0x43 }; + +unsigned char table_86[32] = { + 0x11, 0x07, 0x0F, 0x0A, 0x19, 0x1D, 0x0B, 0x09, + 0x1C, 0x1E, 0x14, 0x06, 0x0C, 0x16, 0x13, 0x04, + 0x15, 0x18, 0x00, 0x0D, 0x12, 0x05, 0x08, 0x02, + 0x10, 0x1A, 0x1F, 0x01, 0x17, 0x0E, 0x03, 0x1B }; + +unsigned char table_87[32] = { + 0x17, 0x0E, 0x1D, 0x13, 0x0B, 0x19, 0x03, 0x06, + 0x09, 0x01, 0x0D, 0x15, 0x1C, 0x16, 0x18, 0x1B, + 0x11, 0x10, 0x00, 0x1E, 0x1F, 0x08, 0x12, 0x0F, + 0x02, 0x04, 0x07, 0x1A, 0x14, 0x0A, 0x0C, 0x05 }; + +unsigned char table_88[32] = { + 0x09, 0x08, 0x17, 0x10, 0x0A, 0x07, 0x1C, 0x1F, + 0x04, 0x0E, 0x01, 0x0C, 0x0D, 0x1B, 0x03, 0x15, + 0x02, 0x1E, 0x18, 0x19, 0x0F, 0x06, 0x1A, 0x0B, + 0x05, 0x11, 0x14, 0x00, 0x16, 0x1D, 0x12, 0x13 }; + +unsigned char table_89[32] = { + 0x15, 0x1C, 0x1D, 0x14, 0x0F, 0x1A, 0x05, 0x02, + 0x07, 0x09, 0x06, 0x08, 0x1F, 0x00, 0x10, 0x13, + 0x0D, 0x03, 0x0C, 0x18, 0x0E, 0x16, 0x1B, 0x1E, + 0x12, 0x04, 0x11, 0x0A, 0x01, 0x0B, 0x17, 0x19 }; + +unsigned char table_90[256] = { + 0x62, 0x36, 0x64, 0x0E, 0x4C, 0x6C, 0xBE, 0xCF, + 0x25, 0x5A, 0x3D, 0x12, 0x54, 0x9F, 0xE7, 0xA5, + 0xDE, 0xD7, 0xB2, 0x60, 0x18, 0x8D, 0x89, 0x70, + 0x48, 0x66, 0x1C, 0xA6, 0x17, 0x9B, 0xDF, 0x9A, + 0x82, 0xB9, 0x2E, 0xFA, 0x83, 0x5B, 0x7A, 0x61, + 0xFC, 0x6B, 0x8B, 0x4E, 0x0F, 0xAD, 0x78, 0xE1, + 0xE8, 0x15, 0x1A, 0xF7, 0xA3, 0x3A, 0x04, 0xE3, + 0x30, 0x8C, 0x06, 0xC4, 0x05, 0x32, 0x1F, 0x6A, + 0xB8, 0x37, 0x58, 0xF5, 0x74, 0x63, 0xD4, 0xAC, + 0xA4, 0xF3, 0xEC, 0xBB, 0x8E, 0x65, 0xA0, 0xEE, + 0x6D, 0x11, 0xDD, 0xEA, 0x68, 0x2B, 0xDA, 0x0B, + 0xEF, 0xC3, 0x8F, 0x03, 0x77, 0x1B, 0xFB, 0x1E, + 0x5C, 0xD9, 0xCB, 0x33, 0x55, 0xF1, 0xA1, 0xF9, + 0x7C, 0x38, 0x95, 0x00, 0x6E, 0x85, 0xC2, 0x7F, + 0xBF, 0x84, 0x2A, 0x13, 0x72, 0x81, 0xE9, 0x59, + 0x41, 0x69, 0x3B, 0x0C, 0x90, 0xB4, 0x51, 0x2F, + 0xA2, 0xFE, 0xF8, 0x49, 0x57, 0xE5, 0x96, 0xFF, + 0xCD, 0xD5, 0xCE, 0xAA, 0x40, 0xB0, 0x4D, 0xBA, + 0xDB, 0xC7, 0x46, 0x86, 0xD1, 0xCA, 0xC0, 0x67, + 0x9C, 0x21, 0xAE, 0xB3, 0x7B, 0x87, 0xE2, 0x71, + 0xE6, 0x39, 0xA8, 0x22, 0x07, 0x2C, 0x44, 0x52, + 0xA7, 0xF0, 0x4A, 0x92, 0x56, 0x28, 0x43, 0x8A, + 0x5E, 0x53, 0x93, 0x47, 0x97, 0x88, 0x76, 0x79, + 0x91, 0x26, 0xC1, 0x3F, 0xB7, 0xF6, 0x3E, 0x80, + 0xA9, 0xC6, 0x01, 0xD2, 0xEB, 0x9E, 0x4B, 0xBC, + 0xC8, 0xB5, 0x02, 0x5F, 0x98, 0x9D, 0x5D, 0x35, + 0xD0, 0x16, 0xB1, 0x23, 0x7D, 0xAF, 0x10, 0x3C, + 0xAB, 0x14, 0x09, 0x2D, 0x0D, 0xC5, 0x1D, 0xD6, + 0x42, 0xF2, 0x34, 0x73, 0xF4, 0xFD, 0xE0, 0x24, + 0x6F, 0xD3, 0x75, 0xD8, 0xCC, 0xB6, 0x99, 0x4F, + 0x29, 0x0A, 0x08, 0xE4, 0x27, 0x19, 0x31, 0xC9, + 0x20, 0x94, 0x45, 0xED, 0xDC, 0xBD, 0x7E, 0x50 }; + +unsigned char table_91[32] = { + 0x03, 0x04, 0x0C, 0x18, 0x10, 0x0D, 0x13, 0x1B, + 0x1F, 0x07, 0x11, 0x17, 0x1C, 0x1D, 0x05, 0x06, + 0x0A, 0x12, 0x02, 0x1A, 0x0B, 0x01, 0x0E, 0x08, + 0x14, 0x16, 0x00, 0x15, 0x19, 0x09, 0x0F, 0x1E }; + +unsigned char table_92[32] = { + 0x1E, 0x10, 0x01, 0x07, 0x11, 0x16, 0x15, 0x17, + 0x1F, 0x14, 0x0C, 0x1C, 0x06, 0x03, 0x00, 0x18, + 0x08, 0x0E, 0x02, 0x1B, 0x09, 0x0D, 0x19, 0x05, + 0x0F, 0x12, 0x0B, 0x13, 0x0A, 0x04, 0x1D, 0x1A }; + +unsigned char table_93[256] = { + 0x76, 0x78, 0xA2, 0x94, 0x0E, 0x7F, 0xDF, 0xC1, + 0xB9, 0xE1, 0x3D, 0x59, 0x6F, 0x1E, 0x53, 0x99, + 0x80, 0xE3, 0x21, 0xF8, 0x65, 0xB8, 0x08, 0xBC, + 0x29, 0x17, 0xFD, 0x33, 0x35, 0xF2, 0x70, 0xC7, + 0x25, 0xD0, 0xCD, 0x7A, 0xB7, 0x9B, 0xA5, 0xC3, + 0x00, 0x90, 0xDC, 0xB1, 0x0C, 0x20, 0x67, 0x8D, + 0x43, 0x49, 0xF3, 0x96, 0x14, 0x1A, 0xC8, 0x19, + 0x72, 0xD7, 0x8A, 0x38, 0x66, 0xDA, 0xDD, 0x2E, + 0xBE, 0xD5, 0x91, 0x7C, 0x3A, 0x92, 0x8E, 0xE7, + 0x51, 0xB5, 0xA8, 0xD9, 0x0B, 0x2A, 0xBA, 0x81, + 0x41, 0x0F, 0xBD, 0x4E, 0x31, 0x23, 0x9C, 0x8B, + 0x2B, 0x1D, 0x04, 0x3E, 0x8C, 0xF0, 0x45, 0xA0, + 0x1C, 0x44, 0x55, 0x5E, 0xF1, 0x98, 0x54, 0x5D, + 0x9D, 0x84, 0xAE, 0x09, 0xA9, 0xC5, 0x83, 0x60, + 0x86, 0x95, 0xB4, 0xFA, 0x6B, 0xA7, 0x9A, 0xCA, + 0x8F, 0x4F, 0x0A, 0x7B, 0xB0, 0x02, 0xEA, 0xA4, + 0x18, 0xDB, 0xD3, 0x64, 0xEB, 0xFC, 0xC4, 0xC9, + 0xF5, 0xD6, 0xCC, 0x75, 0x0D, 0x5C, 0x93, 0x4A, + 0x6D, 0xC0, 0x1F, 0x50, 0xE6, 0x16, 0xEE, 0x07, + 0xFB, 0x74, 0x56, 0x58, 0x52, 0x89, 0x79, 0x68, + 0xB6, 0xFE, 0x01, 0xD4, 0x7E, 0x06, 0xBF, 0xCB, + 0x5B, 0xC2, 0xC6, 0x32, 0xAC, 0x26, 0x22, 0xD2, + 0x82, 0x46, 0x69, 0x15, 0x2C, 0xF7, 0xAD, 0x13, + 0x4D, 0xA3, 0xF6, 0x2D, 0x48, 0x71, 0x57, 0x11, + 0x63, 0x05, 0x5F, 0x9E, 0x4B, 0xAB, 0xA6, 0x61, + 0xBB, 0xA1, 0x3C, 0x97, 0xF9, 0x03, 0x40, 0x12, + 0xCF, 0x37, 0xE4, 0x10, 0x6A, 0xED, 0xFF, 0x62, + 0x42, 0x4C, 0xAF, 0x9F, 0xE5, 0xE8, 0xD8, 0xD1, + 0x28, 0x3F, 0x1B, 0xE9, 0xCE, 0x6C, 0x27, 0x88, + 0xEF, 0x2F, 0xE0, 0x30, 0x87, 0x5A, 0x73, 0xB3, + 0x6E, 0x3B, 0x7D, 0x77, 0x36, 0xAA, 0x39, 0xDE, + 0x24, 0x34, 0xE2, 0xEC, 0x85, 0x47, 0xF4, 0xB2 }; + +unsigned char table_94[32] = { + 0x1C, 0x07, 0x05, 0x1A, 0x10, 0x1D, 0x14, 0x12, + 0x08, 0x0F, 0x0C, 0x01, 0x04, 0x1B, 0x16, 0x0A, + 0x11, 0x02, 0x1F, 0x13, 0x0D, 0x1E, 0x17, 0x06, + 0x0E, 0x09, 0x15, 0x19, 0x03, 0x18, 0x00, 0x0B }; + +unsigned char table_95[32] = { + 0x12, 0x10, 0x11, 0x15, 0x03, 0x0A, 0x14, 0x05, + 0x1D, 0x07, 0x17, 0x0D, 0x09, 0x08, 0x1B, 0x1F, + 0x0B, 0x06, 0x19, 0x0E, 0x18, 0x04, 0x00, 0x02, + 0x1E, 0x1C, 0x01, 0x0C, 0x1A, 0x0F, 0x13, 0x16 }; + +unsigned char table_96[256] = { + 0x1C, 0x6E, 0xCD, 0xB4, 0xB3, 0x93, 0xA8, 0x2E, + 0x4F, 0x09, 0xE3, 0x72, 0x64, 0x13, 0x21, 0xF5, + 0x89, 0xB2, 0xD2, 0x22, 0x5D, 0x63, 0x90, 0xC4, + 0x42, 0x9B, 0x07, 0xCA, 0x16, 0x19, 0x5C, 0x2B, + 0x3D, 0xA0, 0x69, 0x5F, 0x52, 0x41, 0x66, 0xC0, + 0x55, 0xDA, 0x82, 0x40, 0x25, 0x02, 0x3C, 0xDD, + 0xAE, 0xD7, 0xD6, 0xDB, 0x04, 0x78, 0x05, 0x4A, + 0x4C, 0x81, 0x00, 0xBE, 0x45, 0xC5, 0x30, 0xB0, + 0x65, 0x5A, 0xA9, 0x38, 0x75, 0x26, 0x85, 0x4E, + 0xF0, 0xA2, 0x91, 0x8A, 0x54, 0xD0, 0x3E, 0x0D, + 0xFE, 0xF2, 0x0A, 0x23, 0x24, 0x37, 0x32, 0x0B, + 0xCB, 0xB5, 0x28, 0x6A, 0x95, 0x49, 0x53, 0x9A, + 0xEE, 0x2C, 0x9D, 0xD4, 0x1D, 0x46, 0xC9, 0x79, + 0xCC, 0xDF, 0x17, 0xE8, 0x6D, 0x29, 0x0E, 0x80, + 0xE0, 0x62, 0xA1, 0xFA, 0x10, 0xF6, 0x03, 0xC1, + 0x15, 0x14, 0x1F, 0x99, 0x97, 0xD5, 0x9E, 0x3F, + 0x7B, 0x2F, 0xEF, 0x2A, 0x68, 0x83, 0xE2, 0x1B, + 0xC8, 0x87, 0x12, 0x70, 0xC7, 0x36, 0xD3, 0x73, +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x88, 0xE8, 0x5F, 0x04, 0xDA, 0xE4, 0xBC, + 0x83, 0x25, 0x9F, 0xD9, 0x99, 0xC1, 0xFD, 0xB3 }; + +unsigned char table_98[256] = { + 0xC8, 0xE6, 0x38, 0x93, 0xE5, 0x03, 0x18, 0x1F, + 0xE9, 0x5A, 0xB6, 0xAF, 0xC3, 0x95, 0x00, 0x51, + 0xC0, 0xFD, 0x32, 0xE8, 0x96, 0x57, 0xF0, 0xAA, + 0xDC, 0x71, 0xF8, 0x01, 0x40, 0x0A, 0x4F, 0xB0, + 0x1B, 0x9D, 0x16, 0x92, 0xF3, 0x5E, 0xA9, 0x3C, + 0xBE, 0x6A, 0xA7, 0xE3, 0x35, 0x0D, 0xAD, 0xDB, + 0x48, 0xE0, 0x7E, 0xC6, 0xB4, 0x6D, 0x17, 0x41, + 0x3E, 0xE2, 0x87, 0x12, 0xE1, 0x53, 0xD9, 0x8A, + 0xAC, 0xA6, 0xD8, 0xFA, 0x36, 0x0B, 0x06, 0xDF, + 0x6C, 0x4E, 0xA4, 0xBC, 0xC9, 0xEE, 0x44, 0x26, + 0xF2, 0xE4, 0x9E, 0x34, 0xEF, 0x05, 0x0F, 0x7F, + 0xD1, 0xCD, 0x67, 0x28, 0xC1, 0x8E, 0x7D, 0x90, + 0x8F, 0x60, 0x1E, 0x19, 0xBD, 0x77, 0xB8, 0xD5, + 0x3D, 0x8C, 0x31, 0x99, 0x08, 0xDD, 0x04, 0x30, + 0x61, 0xFB, 0xEB, 0x98, 0x15, 0xFC, 0x10, 0xDE, + 0x20, 0xBA, 0xA1, 0xB3, 0xD4, 0x91, 0x6F, 0x9F, + 0x94, 0x5B, 0x42, 0xCB, 0x75, 0x1C, 0xBB, 0x5C, + 0x5D, 0xD6, 0x66, 0x50, 0xB9, 0xF1, 0x82, 0x7B, + 0x33, 0x23, 0x4A, 0xA5, 0x55, 0x97, 0xEA, 0x37, + 0xF4, 0x64, 0x6E, 0xBF, 0x8B, 0xB1, 0x07, 0x9A, + 0x43, 0x11, 0x65, 0xC2, 0x02, 0xDA, 0x9B, 0x25, + 0xCA, 0x3B, 0x7A, 0xCE, 0xA8, 0xCF, 0xF7, 0x56, + 0x6B, 0xF9, 0x47, 0x2A, 0x2E, 0x1D, 0x2D, 0xE7, + 0x46, 0xD0, 0x62, 0x4C, 0x80, 0x4B, 0x2B, 0xF5, + 0x69, 0x9C, 0x45, 0xED, 0x83, 0xAB, 0x74, 0x39, + 0xA3, 0x85, 0xD7, 0x5F, 0xB2, 0x86, 0x22, 0x29, + 0x89, 0x49, 0x1A, 0xC4, 0x52, 0xEC, 0x8D, 0x73, + 0xD3, 0x7C, 0x79, 0xD2, 0x14, 0x4D, 0x84, 0xA2, + 0x0E, 0x70, 0x78, 0x72, 0xB7, 0xA0, 0xC5, 0x81, + 0x58, 0x0C, 0x68, 0x27, 0xFF, 0xF6, 0xAE, 0xCC, + 0x88, 0xFE, 0x24, 0x2F, 0x76, 0x3F, 0x59, 0x21, + 0x54, 0x3A, 0x13, 0x09, 0x2C, 0xB5, 0xC7, 0x63 }; + +unsigned char table_99[32] = { + 0x19, 0x00, 0x10, 0x18, 0x09, 0x11, 0x13, 0x1D, + 0x08, 0x1A, 0x02, 0x05, 0x03, 0x17, 0x12, 0x01, + 0x1F, 0x14, 0x06, 0x07, 0x15, 0x0D, 0x0F, 0x0B, + 0x0E, 0x16, 0x1E, 0x04, 0x1B, 0x0A, 0x0C, 0x1C }; + +unsigned char table_100[256] = { + 0x9B, 0x3A, 0xAE, 0x60, 0x27, 0x67, 0x1E, 0x4E, + 0x91, 0xDA, 0x85, 0x43, 0x5C, 0xCC, 0x89, 0x55, + 0x75, 0x56, 0xF2, 0x86, 0xEB, 0xC4, 0x0D, 0xE6, + 0x63, 0x88, 0x38, 0x59, 0x68, 0xD0, 0x18, 0xF0, + 0xBA, 0x28, 0xF5, 0x80, 0x02, 0x5B, 0xE1, 0xA4, + 0x7A, 0x4B, 0x8E, 0xF7, 0x9E, 0x99, 0x70, 0xEF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, 0xA8, 0x3F, 0x9D, 0x0E, 0xC9, + 0xE4, 0xA2, 0x52, 0xEC, 0x4F, 0xD6, 0xF3, 0x6B, + 0x87, 0xB3, 0x7E, 0xDE, 0xD7, 0x71, 0x65, 0xF1, + 0x30, 0x0C, 0xB2, 0x7B, 0xBE, 0xFB, 0x23, 0x2C }; + +unsigned char table_101[32] = { + 0x18, 0x08, 0x14, 0x17, 0x03, 0x10, 0x19, 0x04, + 0x0D, 0x1C, 0x06, 0x1D, 0x1E, 0x12, 0x11, 0x0B, + 0x0F, 0x02, 0x0E, 0x1B, 0x13, 0x05, 0x07, 0x16, + 0x15, 0x0A, 0x0C, 0x1A, 0x00, 0x01, 0x1F, 0x09 }; + +unsigned char table_102[32] = { + 0x17, 0x1F, 0x0E, 0x05, 0x13, 0x0C, 0x14, 0x1A, + 0x0F, 0x01, 0x12, 0x1C, 0x00, 0x07, 0x0D, 0x02, + 0x10, 0x16, 0x04, 0x11, 0x1D, 0x03, 0x1E, 0x18, + 0x06, 0x15, 0x0A, 0x19, 0x09, 0x08, 0x1B, 0x0B }; + +unsigned char table_103[32] = { + 0x0F, 0x09, 0x1E, 0x11, 0x0D, 0x08, 0x10, 0x00, + 0x01, 0x1F, 0x1D, 0x1C, 0x12, 0x04, 0x07, 0x05, + 0x19, 0x14, 0x1B, 0x02, 0x1A, 0x15, 0x17, 0x16, + 0x18, 0x0B, 0x0A, 0x13, 0x0C, 0x0E, 0x03, 0x06 }; + +unsigned char table_104[256] = { + 0xA4, 0x9F, 0x78, 0x39, 0x3D, 0x81, 0x51, 0x24, + 0x46, 0x2A, 0x56, 0xE8, 0xDF, 0x73, 0xA8, 0xA2, + 0x0D, 0xDC, 0xA5, 0x4F, 0xF0, 0x93, 0xC0, 0x76, + 0x38, 0x70, 0xB0, 0x30, 0x98, 0x13, 0x8B, 0x14, + 0x26, 0x45, 0x0F, 0x7D, 0x34, 0x72, 0x6B, 0x89, + 0x43, 0xE2, 0x96, 0x5B, 0xEF, 0x2B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+ 0x22, 0x55, 0xBF, 0x9D, 0xE0, 0x6A, 0xAD, 0xBA, + 0x91, 0xCA, 0xA3, 0x1C, 0xEE, 0xD8, 0x3B, 0x66, + 0x69, 0x9B, 0x84, 0xA0, 0xB3, 0x6F, 0xFE, 0x52, + 0x97, 0xBB, 0x37, 0x8C, 0x54, 0x53, 0x9E, 0x8F }; + +unsigned char table_105[256] = { + 0x7B, 0x35, 0x11, 0x79, 0x07, 0x2F, 0xF6, 0x82, + 0x8E, 0xB4, 0x6E, 0xD2, 0x6D, 0xC5, 0x8C, 0x1C, + 0xE0, 0xD6, 0x34, 0xF0, 0x4F, 0x25, 0x59, 0xE8, + 0xDF, 0x1D, 0xEB, 0x32, 0x86, 0x51, 0xA4, 0xF2, + 0x5C, 0xD1, 0xC8, 0x41, 0xEC, 0x9D, 0x62, 0xAC, + 0xDD, 0x3E, 0xB8, 0x65, 0x75, 0x89, 0x12, 0x6C, + 0x40, 0x4E, 0xC7, 0x27, 0xE1, 0x37, 0xCF, 0x09, + 0x16, 0x78, 0xAA, 0x58, 0x0D, 0xE6, 0x54, 0xFE, + 0x8F, 0xFD, 0xF9, 0x61, 0x26, 0x3F, 0x2E, 0xCD, + 0x2C, 0x04, 0xB2, 0x80, 0x0F, 0x14, 0x6F, 0xC6, + 0xAB, 0xFB, 0x13, 0xDB, 0x9A, 0x21, 0xB3, 0xC0, + 0xA9, 0x19, 0x70, 0xF3, 0x2B, 0xAE, 0x9B, 0x49, + 0xB7, 0xA8, 0x24, 0x1B, 0x48, 0xEA, 0xED, 0xD9, + 0x47, 0x9E, 0x9C, 0x69, 0x3C, 0x66, 0xBB, 0x06, + 0x46, 0x38, 0x17, 0xB5, 0xCB, 0x05, 0x4A, 0x5E, + 0x15, 0x20, 0xB9, 0xB6, 0x33, 0x4C, 0x7D, 0xA3, + 0xD7, 0xB1, 0x23, 0x72, 0xC3, 0x4B, 0x63, 0xBE, + 0xF7, 0x5B, 0x74, 0x64, 0x77, 0xCC, 0xD3, 0x85, + 0xDE, 0x1A, 0x31, 0x97, 0xA2, 0x8B, 0xFC, 0x10, + 0x5F, 0xDC, 0xD5, 0xB0, 0xBD, 0x55, 0xC1, 0xE7, + 0x0C, 0x50, 0x43, 0x39, 0x71, 0x52, 0xE5, 0xAF, + 0x8A, 0x60, 0x92, 0x2D, 0xD8, 0x03, 0xF5, 0x28, + 0xCA, 0xEF, 0xD0, 0xC2, 0x53, 0x91, 0xA6, 0x73, + 0x56, 0xA5, 0xF1, 0x57, 0x42, 0xF4, 0xD4, 0x36, + 0x8D, 0xBC, 0xE9, 0x7E, 0x02, 0x76, 0x18, 0x0B, + 0x84, 0x5A, 0xE2, 0xBF, 0x68, 0x95, 0x29, 0x98, + 0xAD, 0x88, 0x1F, 0x81, 0x67, 0xA1, 0x3A, 0xA7, + 0x22, 0xF8, 0x01, 0xA0, 0xCE, 0x7A, 0xDA, 0x30, + 0xC4, 0xE4, 0xEE, 0x7C, 0x3B, 0x4D, 0x3D, 0xE3, + 0xFA, 0x6A, 0x7F, 0x99, 0x00, 0x93, 0x0E, 0xFF, + 0x90, 0x0A, 0x2A, 0x5D, 0x96, 0x08, 0x6B, 0x83, + 0xBA, 0x1E, 0x44, 0x87, 0x45, 0x9F, 0xC9, 0x94 }; + +unsigned char table_106[32] = { + 0x03, 0x11, 0x07, 0x1B, 0x0F, 0x14, 0x0C, 0x01, + 0x04, 0x02, 0x09, 0x0A, 0x05, 0x12, 0x06, 0x1F, + 0x1C, 0x0E, 0x0D, 0x15, 0x18, 0x08, 0x00, 0x10, + 0x1E, 0x1D, 0x17, 0x19, 0x13, 0x16, 0x0B, 0x1A }; + +unsigned char table_107[32] = { + 0x13, 0x1B, 0x06, 0x11, 0x1C, 0x07, 0x08, 0x0E, + 0x10, 0x05, 0x09, 0x18, 0x04, 0x15, 0x1E, 0x0F, + 0x1F, 0x12, 0x02, 0x00, 0x17, 0x19, 0x1A, 0x0D, + 0x03, 0x0C, 0x0A, 0x1D, 0x14, 0x01, 0x16, 0x0B }; + +unsigned char table_108[256] = { + 0x99, 0xA3, 0x48, 0xE8, 0x5A, 0x7D, 0x97, 0xCA, + 0x7F, 0x06, 0x9B, 0x04, 0xE0, 0xF3, 0x18, 0xAE, + 0x59, 0xA0, 0x2B, 0x15, 0x85, 0x3E, 0x12, 0x93, + 0x3D, 0x28, 0x32, 0xF5, 0x20, 0x5D, 0x86, 0x00, + 0x1B, 0x2E, 0x36, 0x10, 0x5E, 0x6C, 0xD8, 0x29, + 0xB6, 0x3F, 0x05, 0x1C, 0xCE, 0xC2, 0x34, 0x5F, + 0x5C, 0x79, 0xD1, 0x1F, 0xA2, 0xEE, 0x8A, 0x69, + 0xB5, 0x87, 0x96, 0x6D, 0x4D, 0xC1, 0x61, 0x2C, + 0x11, 0xE7, 0x8E, 0xBF, 0x1E, 0x53, 0xD0, 0x58, + 0x76, 0xA4, 0x60, 0xA9, 0xB0, 0xF9, 0xEA, 0x3C, + 0x52, 0x9A, 0x24, 0xF1, 0x9F, 0xD3, 0x40, 0x0A, + 0x63, 0x78, 0x6A, 0x8B, 0x08, 0x22, 0x16, 0x83, + 0x6B, 0xD2, 0x49, 0x19, 0xBD, 0xFD, 0x62, 0x72, + 0xA8, 0x55, 0xAB, 0x0C, 0xB9, 0x13, 0xD5, 0xF0, + 0xF2, 0x84, 0xAF, 0x2F, 0x7B, 0x2A, 0x21, 0x0F, + 0xDA, 0x30, 0x71, 0xD6, 0x81, 0xE6, 0xEC, 0x41, + 0x90, 0x50, 0x66, 0x0E, 0xA7, 0xB8, 0xF7, 0x3A, + 0xB2, 0xCF, 0x3B, 0xFC, 0x56, 0x6F, 0xC3, 0xA6, + 0xC9, 0xA1, 0x8D, 0xBB, 0x9D, 0x75, 0xF6, 0xAA, + 0x7E, 0xF8, 0x33, 0xEF, 0xBC, 0x7C, 0x23, 0x1A, + 0x92, 0x6E, 0x2D, 0x8F, 0xED, 0xB7, 0xB1, 0x1D, + 0x67, 0x39, 0xAC, 0x0D, 0x74, 0xDB, 0x7A, 0x94, + 0x07, 0x09, 0xC0, 0xD7, 0xAD, 0xFE, 0x54, 0x91, + 0xDE, 0x45, 0xA5, 0x77, 0xCB, 0x37, 0xC6, 0x38, + 0x89, 0x88, 0x17, 0xD9, 0x4F, 0xDF, 0x25, 0xFB, + 0xFA, 0x4C, 0x80, 0x35, 0x82, 0xF4, 0x95, 0xC8, + 0xFF, 0xE9, 0x31, 0x01, 0x14, 0xB3, 0x02, 0x9E, + 0x4E, 0x43, 0x46, 0xC7, 0xEB, 0x51, 0xE5, 0x47, + 0xB4, 0xE3, 0xDC, 0x57, 0xC4, 0x98, 0x03, 0xE1, + 0xBA, 0x68, 0xCD, 0x27, 0xC5, 0x0B, 0xD4, 0x64, + 0x4B, 0x9C, 0x70, 0x65, 0x4A, 0xE4, 0x42, 0xDD, + 0xCC, 0xE2, 0x44, 0x73, 0xBE, 0x26, 0x8C, 0x5B }; + +unsigned char table_109[256] = { + 0xE3, 0x95, 0xDB, 0x09, 0x82, 0x0A, 0x8F, 0x9E, + 0xC9, 0xDC, 0x28, 0x35, 0x0F, 0x8B, 0xA8, 0xA5, + 0x7F, 0x3D, 0x8C, 0xD1, 0x93, 0x57, 0x04, 0xAA, + 0x6A, 0x98, 0x81, 0xDD, 0x16, 0x67, 0x2E, 0xDF, + 0xED, 0xF7, 0xB2, 0xBD, 0x14, 0xB6, 0x76, 0xC8, + 0x75, 0x9F, 0x48, 0xAE, 0xBB, 0xB0, 0xF3, 0xE2, + 0xD4, 0x59, 0xD8, 0x9C, 0x64, 0xC1, 0x73, 0x21, + 0x6D, 0x96, 0x7B, 0x62, 0x56, 0x55, 0xCC, 0xFD, + 0xCE, 0x41, 0xA3, 0x43, 0x33, 0xAF, 0x23, 0x9D, + 0x6F, 0x65, 0x19, 0x52, 0xAD, 0xC6, 0xD3, 0x3F, + 0x66, 0xFF, 0xD0, 0x30, 0x6C, 0xC0, 0xEB, 0xCF, + 0x51, 0x88, 0x38, 0x72, 0x69, 0x77, 0x3B, 0xFA, + 0xBA, 0xB7, 0xA1, 0x91, 0xE0, 0x89, 0xAB, 0x44, + 0x1B, 0x05, 0x5B, 0xB9, 0x71, 0x47, 0x7E, 0xFB, + 0x02, 0xC7, 0x99, 0x6E, 0x42, 0x20, 0x90, 0x1F, + 0x4A, 0x85, 0x1A, 0xEA, 0x0C, 0x0D, 0xB3, 0xDA, + 0xE7, 0x13, 0xE6, 0xD7, 0x6B, 0x12, 0x46, 0x53, + 0xB5, 0xF8, 0x1D, 0x83, 0x54, 0x49, 0x8A, 0x26, + 0x4D, 0xDE, 0xF6, 0x03, 0xA2, 0x7D, 0x0E, 0xA0, + 0x68, 0x79, 0xCA, 0x0B, 0x5D, 0x40, 0x4F, 0x80, + 0xC2, 0xD6, 0x87, 0x70, 0xF0, 0xD2, 0x92, 0xEE, + 0xBE, 0x74, 0x5F, 0xBC, 0xA4, 0x4B, 0xFE, 0x37, + 0x60, 0xA9, 0x06, 0xA7, 0xE1, 0xF5, 0x2B, 0x10, + 0xEF, 0x2C, 0x07, 0x86, 0x7A, 0x27, 0xE9, 0xC5, + 0xAC, 0x32, 0x22, 0xF2, 0xE5, 0x8D, 0x31, 0x01, + 0x34, 0xA6, 0xB8, 0xC3, 0x3C, 0xE4, 0x08, 0x94, + 0x15, 0x4E, 0xB4, 0x39, 0x58, 0x00, 0x3E, 0x29, + 0x45, 0x3A, 0x84, 0x36, 0xF1, 0x2A, 0x50, 0x11, + 0xC4, 0x5A, 0xFC, 0xBF, 0xD9, 0xF9, 0x17, 0x9B, + 0x8E, 0x18, 0x63, 0x4C, 0x2F, 0x78, 0x2D, 0x5E, + 0x9A, 0xCD, 0x24, 0xEC, 0x7C, 0x97, 0x61, 0xCB, + 0x1E, 0xF4, 0xD5, 0xB1, 0x5C, 0x25, 0xE8, 0x1C }; + +unsigned char table_110[256] = { + 0xC3, 0x06, 0x3C, 0xCB, 0xD2, 0x44, 0x9D, 0x48, + 0x28, 0xAA, 0xA9, 0xD0, 0x64, 0x25, 0x56,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53, 0xB0, 0xBE, 0xAC, 0xAF, 0x73, 0x24, + 0xDA, 0x58, 0xE2, 0xFC, 0x78, 0xEA, 0xCD, 0xFA, + 0x37, 0xED, 0x13, 0x19, 0xC0, 0x59, 0x83, 0xBA, + 0x3F, 0x57, 0x00, 0x7E, 0xC9, 0x2E, 0x17, 0x5B, + 0x84, 0xF6, 0xE7, 0x22, 0xFB, 0x5F, 0x4C, 0x2C, + 0x61, 0x9F, 0x45, 0x39, 0xB3, 0xEC, 0x04, 0x87, + 0x67, 0xDC, 0x0B, 0xF4, 0x20, 0xAB, 0x6B, 0x9E, + 0x4B, 0xCF, 0xB4, 0x2F, 0xBB, 0xEF, 0xDB, 0x33 }; + +unsigned char table_111[32] = { + 0x09, 0x0F, 0x00, 0x15, 0x12, 0x17, 0x1A, 0x0D, + 0x1C, 0x0B, 0x01, 0x0A, 0x05, 0x1E, 0x1D, 0x0C, + 0x1B, 0x08, 0x19, 0x18, 0x14, 0x07, 0x0E, 0x03, + 0x10, 0x16, 0x11, 0x1F, 0x04, 0x06, 0x02, 0x13 }; + +unsigned char table_112[256] = { + 0xF9, 0x7D, 0xBE, 0xD5, 0x9F, 0xB8, 0x95, 0x43, + 0xDB, 0xAE, 0x7E, 0xEC, 0x5B, 0x58, 0x18, 0x49, + 0x4B, 0x9D, 0x1C, 0x3E, 0x61, 0xD1, 0xF6, 0x2F, + 0x41, 0x82, 0x51, 0x37, 0x72, 0x79, 0x05, 0x2A, + 0xC2, 0xB0, 0xE2, 0xE7, 0xB2, 0xF3, 0x1B, 0x92, + 0x86, 0xBB, 0xDC, 0x90, 0x1A, 0x19, 0xD7, 0xBA, + 0x2C, 0x7B, 0xEF, 0xC7, 0x8A, 0x81, 0xEB, 0xDE, + 0x73, 0x4E, 0xB7, 0x97, 0xCA, 0x29, 0x85, 0xC1, + 0xA5, 0x7F, 0xFE, 0x56, 0xE9, 0x9E, 0x21, 0x76, + 0x3A, 0x88, 0x70, 0xC6, 0xD3, 0x8C, 0x47, 0xC8, + 0x83, 0x48, 0xC3, 0x6A, 0x9C, 0x80, 0x53, 0xBD, + 0xFD, 0x54, 0x09, 0x91, 0x94, 0xAA, 0x7A, 0x59, + 0x71, 0xDD, 0xA8, 0x07, 0xCB, 0x0F, 0xE0, 0x9A, + 0x36, 0x4C, 0x4D, 0x0D, 0xA4, 0x96, 0x6F, 0x14, + 0x22, 0x38, 0xAD, 0x02, 0xF4, 0x0B, 0xEA, 0x93, + 0x20, 0x04, 0xBC, 0xE8, 0x6C, 0xFB, 0x10, 0x6B, + 0x40, 0xB6, 0x24, 0x17, 0x06, 0x31, 0xD9, 0x33, + 0xF5, 0x99, 0x57, 0xCD, 0xAB, 0x67, 0x5C, 0x30, + 0x1E, 0x34, 0xB4, 0x3F, 0x16, 0x42, 0xA2, 0x68, + 0x27, 0xB3, 0x1D, 0xED, 0x5F, 0x52, 0xF7, 0x3C, + 0x65, 0x5D, 0xE5, 0x23, 0x0C, 0x6D, 0x84, 0x6E, + 0xDA, 0x77, 0xF8, 0x15, 0xFA, 0x69, 0xD0, 0xA7, + 0x11, 0xAC, 0xA6, 0xA3, 0x1F, 0x2E, 0xBF, 0x4A, + 0x8F, 0xFC, 0xEE, 0xC9, 0x26, 0x12, 0xC0, 0xB1, + 0x45, 0x0E, 0x3D, 0x7C, 0xCE, 0x13, 0x8E, 0x98, + 0x46, 0x2B, 0xC5, 0x66, 0x28, 0x32, 0xD2, 0x03, + 0xE3, 0xC4, 0x9B, 0x89, 0x5E, 0xF0, 0xCF, 0x3B, + 0x2D, 0x50, 0xB5, 0x00, 0x0A, 0xD6, 0x55, 0xE1, + 0x62, 0x63, 0x64, 0x87, 0xAF, 0x78, 0xB9, 0xF2, + 0x25, 0x44, 0xFF, 0x39, 0xF1, 0x08, 0x4F, 0x74, + 0xA9, 0x8B, 0x75, 0x01, 0xA0, 0xE4, 0x35, 0x8D, + 0xA1, 0xCC, 0xDF, 0x60, 0xD8, 0x5A, 0xE6, 0xD4 }; + +unsigned char table_113[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, 0x61, 0x7F, 0x21, 0x98, 0x2A, 0xAD, + 0xB6, 0xA7, 0xF5, 0x3F, 0x15, 0x45, 0xF8, 0xA4, + 0x95, 0x88, 0xDC, 0x96, 0x90, 0x08, 0x9B, 0xF9, + 0x06, 0x14, 0x05, 0xF0, 0xF7, 0xA0, 0xE0, 0x65, + 0xCA, 0xA5, 0x9F, 0x79, 0xCD, 0x4F, 0x72, 0xB7, + 0x4A, 0x0F, 0x66, 0xC5, 0x0C, 0x52, 0xF3, 0x69, + 0x83, 0x03, 0x99, 0x1E, 0x2D, 0xDA, 0x8C, 0x53, + 0x28, 0xDD, 0xE9, 0x0B, 0xC9, 0xF4, 0x48, 0x12, + 0x6A, 0x19, 0xCE, 0xAB, 0x51, 0xD5, 0x6B, 0xBB, + 0xFE, 0x7B, 0x67, 0xFF, 0x10, 0xEC, 0xC6, 0x86 }; + +unsigned char table_114[32] = { + 0x11, 0x10, 0x04, 0x1D, 0x08, 0x15, 0x1A, 0x1B, + 0x14, 0x18, 0x0F, 0x17, 0x16, 0x07, 0x1E, 0x0E, + 0x12, 0x0A, 0x13, 0x0B, 0x0C, 0x00, 0x06, 0x02, + 0x1F, 0x19, 0x09, 0x1C, 0x01, 0x0D, 0x03, 0x05 }; + +unsigned char table_115[256] = { + 0xB7, 0xBB, 0x63, 0x0D, 0xF0, 0x33, 0x5A, 0x05, + 0xF2, 0x7F, 0x64, 0xDB, 0x51, 0xC9, 0x2C, 0x85, + 0x4F, 0x41, 0xA4, 0x42, 0xCF, 0xA6, 0x52, 0x2F, + 0x26, 0xEF, 0xFB, 0x29, 0x40, 0x16, 0xF7, 0xED, + 0x23, 0x69, 0x8A, 0xDF, 0x77, 0x28, 0x93, 0x14, + 0x82, 0x0C, 0xBE, 0x3D, 0x20, 0xB4, 0x79, 0x94, + 0x54, 0xF8, 0x07, 0xB1, 0xE1, 0x66, 0x73, 0xD3, + 0x19, 0x15, 0xFF, 0x03, 0x6A, 0x9A, 0xDC, 0x1C, + 0xB3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0x0F, 0x2E, 0x81, 0x7E, 0xA1, + 0x8C, 0x17, 0xB5, 0xEB, 0xD5, 0xF3, 0x0B, 0x3C }; + +unsigned char table_116[32] = { + 0x00, 0x05, 0x10, 0x1C, 0x0C, 0x1A, 0x04, 0x1B, + 0x0A, 0x0D, 0x14, 0x0B, 0x07, 0x03, 0x12, 0x1E, + 0x06, 0x11, 0x01, 0x08, 0x15, 0x09, 0x1F, 0x0F, + 0x19, 0x18, 0x16, 0x02, 0x13, 0x0E, 0x17, 0x1D }; + +unsigned char table_117[256] = { + 0xD0, 0x9A, 0xAB, 0xA8, 0xA7, 0xDF, 0x28, 0xCE, + 0x3E, 0x51, 0xBF, 0x76, 0x03, 0xA0, 0x53, 0x3F, + 0x90, 0x93, 0x87, 0x67, 0x98, 0x3D, 0xEA, 0x8B, + 0x55, 0xCF, 0x10, 0xF3, 0x25, 0xFC, 0x9F, 0x41, + 0x6B, 0x54, 0x6E, 0x0B, 0x83, 0x35, 0x69, 0x7D, + 0xE0, 0x88, 0x4B, 0xE9, 0x1E, 0x96, 0x91, 0x57, + 0xBD, 0x72, 0x21, 0x3C, 0xA6, 0x99, 0x6C, 0xF6, + 0x13, 0xFA, 0x29, 0xED, 0xDB, 0x16, 0x4D, 0x07, + 0x45, 0xA5, 0xE3, 0x0E, 0x31, 0xBC, 0x56, 0x5C, + 0xB2, 0x23, 0xDA, 0x74, 0xFF, 0x02, 0x8F, 0xF4, + 0x2A, 0xC9, 0x89, 0xAA, 0x05, 0xB1, 0xD1, 0x1F, + 0x4F, 0xB0, 0x7A, 0x2C, 0x14, 0xD9, 0xE7, 0x66, + 0x62, 0x1A, 0x4C, 0xC0, 0xC6, 0x63, 0x7F, 0xB4, + 0xF1, 0x43, 0xFE, 0x61, 0xA3, 0xCC, 0xE8, 0x6D, + 0xBA, 0x65, 0x42, 0x2B, 0xCA, 0xD5, 0x52, 0x3A, + 0xCD, 0x1D, 0x24, 0xD7, 0x47, 0xDE, 0x9E, 0x95, + 0x85, 0x48, 0x86, 0xE1, 0xC5, 0xD2, 0x34, 0xAF, + 0x40, 0xFB, 0xE6, 0x4E, 0xC8, 0xF5, 0x7B, 0x5A, + 0xCB, 0xD4, 0x97, 0x6F, 0x0C, 0x79, 0x9C, 0x20, + 0x59, 0x19, 0x68, 0x2E, 0x09, 0x64, 0x73, 0x50, + 0xC2, 0x2F, 0x0D, 0xEF, 0x9D, 0x94, 0x00, 0x81, + 0xE2, 0x46, 0x5F, 0xB8, 0x0A, 0x12, 0x75, 0x1C, + 0x8C, 0xB6, 0x71, 0xAC, 0x04, 0x60, 0xA9, 0x5B, + 0xF8, 0x30, 0x49, 0x44, 0x4A, 0xBE, 0x6A, 0xEB, + 0xD3, 0xD8, 0x36, 0xB3, 0x3B, 0x17, 0x80, 0xA4, + 0xEC, 0x26, 0x82, 0xB5, 0x37, 0x5D, 0x1B, 0x2D, + 0xE5, 0xA2, 0x0F, 0xB7, 0xC4, 0xF2, 0x70, 0x39, + 0xF9, 0xC7, 0xBB, 0x8A, 0x32, 0x78, 0xC3, 0x5E, + 0xD6, 0xE4, 0x22, 0x9B, 0x18, 0x8E, 0xEE, 0x27, + 0x8D, 0x33, 0x11, 0x77, 0x01, 0x06, 0x38, 0xF0, + 0x7E, 0x08, 0x15, 0xB9, 0x7C, 0xAD, 0x84, 0xDD, + 0xC1, 0xFD, 0x92, 0xA1, 0xF7, 0xAE, 0xDC, 0x58 }; + +unsigned char table_118[256] = { + 0x38, 0xA0, 0xA6, 0xFC, 0x7C, 0x5A, 0x97, 0x1D, + 0xFD, 0x00, 0x20, 0xA2, 0x72, 0x10, 0x1F, 0x48, + 0x98, 0x7E, 0xDF, 0x2D, 0x80, 0x0A, 0x27, 0xDC, + 0xCF, 0xBF, 0x92, 0x94, 0x53, 0xCC, 0x0E, 0x74, + 0xA7, 0x60, 0x08, 0x15, 0x87, 0x6F, 0xB3, 0xA3, + 0xED, 0x59, 0x09, 0x4F, 0x9E, 0x9A, 0xEE, 0x83, + 0x56, 0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x29, 0x0F, 0xF4, 0x7B, 0x13, + 0x88, 0x44, 0xC2, 0x2E, 0xFA, 0xFE, 0x04, 0x35, + 0xE8, 0x06, 0x7A, 0x78, 0x0D, 0x81, 0xF7, 0xEA, + 0xD9, 0x2F, 0x02, 0xAC, 0x30, 0x6A, 0xD6, 0x95 }; + +unsigned char table_119[32] = { + 0x14, 0x0A, 0x1C, 0x00, 0x0C, 0x1F, 0x1E, 0x0B, + 0x12, 0x1D, 0x17, 0x08, 0x07, 0x04, 0x09, 0x10, + 0x03, 0x1B, 0x0E, 0x1A, 0x05, 0x0D, 0x11, 0x15, + 0x18, 0x02, 0x06, 0x01, 0x19, 0x16, 0x13, 0x0F }; + +unsigned char table_120[256] = { + 0xCE, 0x89, 0xB2, 0x72, 0x04, 0x77, 0x64, 0xAE, + 0x80, 0x99, 0xB5, 0x00, 0x7B, 0x50, 0x9D, 0xE3, + 0x87, 0x37, 0x6D, 0x3D, 0x32, 0xBA, 0x20, 0xF0, + 0xDC, 0xBD, 0x61, 0x26, 0xD4, 0xA6, 0x70, 0x54, + 0xC1, 0x7D, 0x82, 0xFF, 0x81, 0x83, 0x2F, 0xF5, + 0x3B, 0x42, 0x08, 0x5C, 0x30, 0x59, 0xBB, 0xC2, + 0x33, 0x5D, 0xEE, 0xB7, 0xF7, 0x2B, 0x76, 0xD0, + 0x43, 0x1C, 0x48, 0xFC, 0x01, 0xCD, 0x27, 0x1D, + 0x5A, 0x96, 0x95, 0x03, 0xC6, 0x1F, 0x09, 0xCB, + 0xF6, 0x47, 0xA9, 0x93, 0xA7, 0xD2, 0xDB, 0x51, + 0xB0, 0x7A, 0xE6, 0x62, 0x0F, 0x12, 0x57, 0xF4, + 0x35, 0xFE, 0xA4, 0xDF, 0x5B, 0xF3, 0x67, 0x85, + 0x98, 0xE4, 0xAB, 0x75, 0x4C, 0xE2, 0x25, 0x74, + 0x3A, 0x45, 0xDE, 0xEF, 0x4A, 0x97, 0x86, 0x24, + 0xE9, 0x8F, 0xD8, 0xD7, 0x60, 0xAD, 0x36, 0x8E, + 0x1E, 0xB9, 0x4F, 0x6B, 0x8C, 0x06, 0x23, 0x94, + 0x0E, 0xD3, 0x49, 0x14, 0x90, 0xAF, 0x65, 0xEC, + 0xF9, 0x0D, 0xED, 0x6C, 0xBE, 0x7F, 0xA5, 0xC5, + 0xEA, 0x78, 0x2E, 0xBC, 0xD5, 0xDA, 0x18, 0xE1, + 0x10, 0x2D, 0xB4, 0x16, 0x4B, 0xE8, 0xC4, 0x8D, + 0x19, 0x1B, 0x02, 0x66, 0xB6, 0xE7, 0x9C, 0x7C, + 0xC9, 0xA0, 0x2A, 0x53, 0x13, 0xDD, 0xF8, 0xA8, + 0x0A, 0x6E, 0xCF, 0x6F, 0x7E, 0xE0, 0x3E, 0xE5, + 0x07, 0xCC, 0x38, 0xD1, 0xF2, 0x2C, 0x9A, 0xAC, + 0x88, 0x79, 0xB8, 0xC8, 0xBF, 0x63, 0x71, 0x69, + 0x52, 0x39, 0x9F, 0x22, 0x3F, 0x9E, 0x44, 0xFA, + 0x73, 0x6A, 0x8B, 0xA2, 0xD6, 0x1A, 0x9B, 0xB1, + 0x8A, 0x4D, 0x58, 0xA1, 0x46, 0x5F, 0x55, 0x56, + 0x21, 0x05, 0x15, 0x92, 0xAA, 0xEB, 0x31, 0x68, + 0xFB, 0x41, 0xC3, 0x4E, 0xB3, 0x40, 0x34, 0x17, + 0xD9, 0x29, 0x3C, 0x0C, 0xF1, 0x0B, 0x28, 0x84, + 0x5E, 0xCA, 0xFD, 0x11, 0xA3, 0xC7, 0xC0, 0x91 }; + +unsigned char table_121[32] = { + 0x1E, 0x12, 0x06, 0x1D, 0x15, 0x1F, 0x13, 0x0B, + 0x10, 0x0D, 0x1C, 0x01, 0x0A, 0x0E, 0x02, 0x19, + 0x04, 0x1A, 0x03, 0x11, 0x00, 0x16, 0x0C, 0x17, + 0x14, 0x08, 0x18, 0x05, 0x09, 0x0F, 0x1B, 0x07 }; + +unsigned char table_122[256] =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, 0x9C, 0xA4, 0xDB, 0xF7, + 0xA9, 0x20, 0xF2, 0x1A, 0xDC, 0x33, 0x3A, 0xEF, + 0xD3, 0xFD, 0x30, 0xB0, 0x1B, 0xC4, 0x06, 0xD4, + 0x6D, 0x87, 0x2F, 0x60, 0x5F, 0xC5, 0x09, 0x37, + 0xAF, 0x00, 0xCB, 0x9D, 0xA0, 0xB9, 0x45, 0x86, + 0x4F, 0x6C, 0x67, 0xFB, 0x40, 0x3F, 0xCC, 0xB8, + 0xC8, 0x82, 0x98, 0x99, 0x7B, 0xB1, 0xCD, 0xD0, + 0xBD, 0x48, 0xAD, 0x26, 0x7A, 0x9A, 0x46, 0xFF, + 0x89, 0xC7, 0xC1, 0xCF, 0xBE, 0xAA, 0xEC, 0xBA, + 0xCE, 0x2D, 0x4E, 0x83, 0xC3, 0x69, 0xEE, 0xB2 }; + +unsigned char table_123[256] = { + 0x9D, 0xFB, 0x3C, 0x81, 0xAA, 0x05, 0xB2, 0xBE, + 0xD1, 0x5F, 0x4C, 0xE0, 0xA3, 0xF4, 0xDE, 0x35, + 0xFE, 0x1B, 0x37, 0x99, 0x94, 0x7A, 0x10, 0xAB, + 0xC0, 0xA4, 0xB5, 0xFF, 0x8F, 0x3B, 0xB4, 0x51, + 0x04, 0xE9, 0xB9, 0xC1, 0x98, 0xC5, 0x82, 0x38, + 0x4D, 0x71, 0xFC, 0x33, 0xC4, 0x50, 0x5D, 0x88, + 0xB8, 0x5C, 0x32, 0xE2, 0xBB, 0xCD, 0x60, 0x2C, + 0xD4, 0x7E, 0x27, 0x59, 0x2B, 0x1F, 0x53, 0xF6, + 0x25, 0x86, 0xAE, 0x21, 0xFA, 0x31, 0xD7, 0x0F, + 0x17, 0xDA, 0x7F, 0xC9, 0x46, 0x19, 0x08, 0xA8, + 0xCF, 0x13, 0xCC, 0x03, 0x3F, 0x22, 0x6E, 0xEB, + 0x4A, 0x63, 0x73, 0xBD, 0x36, 0xED, 0x30, 0x57, + 0x65, 0xF8, 0x41, 0x61, 0x1E, 0xA0, 0xC6, 0x45, + 0x3E, 0x75, 0x28, 0x87, 0xCB, 0xD6, 0x16, 0xD8, + 0xDF, 0xEF, 0xEA, 0xA7, 0x58, 0xB0, 0x1D, 0xE6, + 0x47, 0x76, 0xD9, 0x96, 0xE7, 0xDC, 0x00, 0x80, + 0xDD, 0xB7, 0x9A, 0xE1, 0xF5, 0x9C, 0x4B, 0xE3, + 0xBC, 0x8D, 0xF2, 0x2F, 0x9F, 0x6C, 0x93, 0xAF, + 0xA9, 0xC2, 0x5E, 0x24, 0x15, 0xD2, 0x09, 0x0D, + 0xDB, 0x4F, 0x91, 0x0E, 0x64, 0x34, 0x4E, 0xAD, + 0x62, 0x44, 0x23, 0x85, 0xB6, 0xAC, 0xC7, 0xCA, + 0x84, 0xF9, 0x8C, 0xBF, 0x14, 0x7C, 0x8E, 0x92, + 0xF0, 0x0B, 0xCE, 0x90, 0x7D, 0x70, 0x9E, 0x54, + 0x39, 0x5B, 0x6D, 0x52, 0xEE, 0xA2, 0x6F, 0x78, + 0x2D, 0x95, 0x8B, 0x02, 0x3D, 0x7B, 0x69, 0xC3, + 0x49, 0xA5, 0x1A, 0x26, 0xD5, 0x6B, 0xE8, 0xFD, + 0xB3, 0xD3, 0x20, 0x55, 0x18, 0x06, 0xF3, 0xB1, + 0x0C, 0xC8, 0x07, 0x12, 0xF7, 0x01, 0x2E, 0x72, + 0x97, 0xA6, 0x11, 0x89, 0x56, 0x5A, 0x29, 0xBA, + 0x67, 0x42, 0x83, 0x6A, 0x2A, 0xF1, 0xA1, 0x9B, + 0xE5, 0xE4, 0x74, 0x66, 0x1C, 0x68, 0xEC, 0x40, + 0x48, 0x77, 0xD0, 0x0A, 0x8A, 0x3A, 0x43, 0x79 }; + +unsigned char table_124[256] = { + 0x6C, 0xC3, 0x28, 0x2F, 0x42, 0x4B, 0x7C, 0x3C, + 0xCE, 0x24, 0xC8, 0x51, 0x25, 0x3F, 0x49, 0x8D, + 0x1E, 0x5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A5, 0x93, 0x43, 0xF0, + 0x8C, 0xE6, 0x34, 0x21, 0xD9, 0xC2, 0xD8, 0xC6, + 0x6A, 0xD6, 0xCB, 0xAC, 0x75, 0xB5, 0x78, 0x0A, + 0xA3, 0x69, 0x16, 0xBA, 0x50, 0x2A, 0x41, 0x83, + 0xF6, 0x64, 0x00, 0x65, 0x7E, 0xDD, 0x5B, 0xDA, + 0x14, 0xFD, 0x3E, 0x7F, 0xCA, 0x66, 0x4A, 0x1F, + 0xA2, 0xAD, 0xF2, 0x23, 0xBB, 0x72, 0xF3, 0x94, + 0x62, 0x1B, 0xDE, 0x91, 0x87, 0x97, 0x05, 0x2E }; + +unsigned char table_125[32] = { + 0x1A, 0x18, 0x12, 0x15, 0x00, 0x1C, 0x01, 0x0B, + 0x19, 0x1B, 0x1F, 0x11, 0x07, 0x10, 0x1E, 0x06, + 0x17, 0x04, 0x0A, 0x0E, 0x0D, 0x0C, 0x16, 0x08, + 0x02, 0x03, 0x13, 0x14, 0x09, 0x1D, 0x05, 0x0F }; + +unsigned char table_126[32] = { + 0x1C, 0x1D, 0x07, 0x12, 0x18, 0x1A, 0x19, 0x09, + 0x0F, 0x14, 0x1F, 0x0B, 0x13, 0x04, 0x0E, 0x1E, + 0x0C, 0x0D, 0x01, 0x17, 0x1B, 0x16, 0x0A, 0x05, + 0x15, 0x10, 0x11, 0x08, 0x00, 0x03, 0x06, 0x02 }; + +unsigned char table_127[256] = { + 0xA0, 0x66, 0xD8, 0x08, 0xEA, 0x39, 0x78, 0xAB, + 0x61, 0x4E, 0xC7, 0xD1, 0xA3, 0x1C, 0x9F, 0xCB, + 0x19, 0x51, 0x15, 0x92, 0x23, 0xFD, 0x7D, 0x1D, + 0x95, 0xAE, 0x0E, 0x8B, 0xE6, 0x7F, 0x86, 0x6D, + 0x06, 0xBD, 0x20, 0x1F, 0x3A, 0xE4, 0x54, 0x91, + 0x69, 0xD3, 0xE3, 0x3D, 0x4D, 0x31, 0x49, 0xA4, + 0x41, 0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0x12, 0x62, 0x24, 0x60, + 0x4B, 0x73, 0x0C, 0xF0, 0xFA, 0x42, 0xF4, 0x00, + 0xD2, 0xD0, 0xD6, 0x3B, 0xC2, 0x2F, 0xE1, 0x2B, + 0x70, 0xF8, 0x17, 0xCD, 0xB0, 0xCC, 0x82, 0x2D }; + +unsigned char table_128[32] = { + 0x1A, 0x1C, 0x09, 0x17, 0x1B, 0x0B, 0x16, 0x1E, + 0x14, 0x0C, 0x12, 0x0E, 0x05, 0x03, 0x1F, 0x15, + 0x19, 0x0D, 0x10, 0x13, 0x0A, 0x01, 0x00, 0x11, + 0x02, 0x08, 0x0F, 0x18, 0x07, 0x04, 0x1D, 0x06 }; + +unsigned char table_129[256] = { + 0x9D, 0x5F, 0xE8, 0x99, 0x57, 0x07, 0x16, 0xA6, + 0x9F, 0xB6, 0xDE, 0xED, 0x2D, 0xB3, 0xC0, 0x8E, + 0xCC, 0x49, 0xCE, 0xB0, 0x1B, 0xB1, 0x7A, 0xE0, + 0xEB, 0x28, 0xDB, 0x7D, 0x88, 0xC8, 0x06, 0x6C, + 0x02, 0xD0, 0x85, 0x7E, 0xDF, 0xF5, 0x78, 0xE5, + 0xA9, 0x71, 0xD9, 0xDD, 0xDC, 0xEE, 0x8C, 0x54, + 0xA0, 0x86, 0xFE, 0x0E, 0x55, 0xF7, 0x41, 0x47, + 0x1D, 0x15, 0xD6, 0xA4, 0xFF, 0x1F, 0x25, 0xF8, + 0x12, 0xE9, 0x74, 0x7B, 0x04, 0xE6, 0x4C, 0x31, + 0xA2, 0xBE, 0x0C, 0xB9, 0x17, 0xBD, 0x3D, 0xF0, + 0x9E, 0x4D, 0x4E, 0xB2, 0xE7, 0x40, 0xC9, 0x8A, + 0x67, 0x5E, 0x19, 0x0F, 0xB7, 0x22, 0x8D, 0xBA, + 0xFC, 0x93, 0x14, 0xEA, 0xFD, 0x0D, 0xD5, 0x38, + 0xA1, 0x84, 0x1C, 0x35, 0x60, 0x37, 0x43, 0x9C, + 0xCF, 0xEF, 0x3A, 0x72, 0xF2, 0x61, 0x75, 0x6A, + 0x42, 0xAC, 0xD3, 0x48, 0x77, 0xC5, 0x29, 0xF6, + 0x58, 0x79, 0xFA, 0x5D, 0xC7, 0x70, 0x53, 0x9A, + 0x6F, 0xC1, 0x0A, 0x90, 0x8F, 0x3E, 0x3B, 0x8B, + 0xEC, 0xBC, 0x20, 0x27, 0xC3, 0x66, 0x3F, 0x33, + 0xA5, 0x44, 0x2E, 0x32, 0x65, 0x18, 0xFB, 0x59, + 0x52, 0x50, 0xE2, 0x63, 0x2B, 0xCD, 0x64, 0xCB, + 0xD2, 0x68, 0x10, 0xA7, 0xAE, 0x11, 0xA8, 0x96, + 0x69, 0xAF, 0xC2, 0x34, 0x5C, 0x56, 0xE3, 0xF9, + 0xDA, 0x51, 0x81, 0x4A, 0x05, 0x00, 0xB8, 0x7C, + 0x30, 0x2F, 0x46, 0xB4, 0xC6, 0x87, 0x4B, 0x94, + 0x80, 0xF4, 0x7F, 0x3C, 0x26, 0xF1, 0x5B, 0xAB, + 0x91, 0x6E, 0x08, 0x76, 0x98, 0xD1, 0xE1, 0x36, + 0x21, 0xCA, 0xD8, 0x24, 0x9B, 0x39, 0xBB, 0xAD, + 0x13, 0x62, 0x97, 0x1A, 0x6D, 0x2C, 0x5A, 0xC4, + 0xD4, 0xA3, 0x03, 0xBF, 0x1E, 0xE4, 0xF3, 0x95, + 0x23, 0x73, 0x92, 0xB5, 0x01, 0x83, 0x82, 0xAA, + 0x09, 0x45, 0x6B, 0xD7, 0x0B, 0x89, 0x4F, 0x2A }; + +unsigned char table_130[32] = { + 0x07, 0x03, 0x15, 0x0B, 0x02, 0x11, 0x17, 0x14, + 0x05, 0x10, 0x0A, 0x0F, 0x01, 0x1C, 0x1D, 0x0E, + 0x12, 0x06, 0x18, 0x16, 0x1A, 0x09, 0x13, 0x19, + 0x1B, 0x00, 0x08, 0x0D, 0x0C, 0x1E, 0x04, 0x1F }; + +unsigned char table_131[32] = { + 0x1D, 0x13, 0x1B, 0x10, 0x07, 0x03, 0x0A, 0x02, + 0x00, 0x0C, 0x0E, 0x0B, 0x0D, 0x18, 0x12, 0x1F, + 0x1A, 0x04, 0x15, 0x11, 0x1E, 0x08, 0x1C, 0x14, + 0x19, 0x05, 0x0F, 0x17, 0x06, 0x01, 0x09, 0x16 }; + +unsigned char table_132[256] = { + 0x33, 0x8D, 0x45, 0x6F, 0xFF, 0xF5, 0xB6, 0x53, + 0x3B, 0xF3, 0x07, 0xA4, 0x97, 0xEB, 0x6B, 0xA5, + 0xD3, 0xDC, 0x7B, 0x79, 0x93, 0xE7, 0xF7, 0x67, + 0x9C, 0x4F, 0x88, 0xF9, 0x3A, 0x2B, 0x27, 0x48, + 0x47, 0x18, 0xF4, 0xAD, 0xB4, 0x8F, 0x2A, 0x76, + 0x17, 0xE9, 0x1F, 0x40, 0x0C, 0x59, 0xD1, 0x4C, + 0x20, 0x31, 0x73, 0x54, 0xCD, 0x68, 0x08, 0x52, + 0x10, 0x62, 0x3D, 0xD2, 0x77, 0xF2, 0xD7, 0x30, + 0xCA, 0x16, 0x01, 0x50, 0x9F, 0x3F, 0x75, 0xED, + 0x90, 0x6A, 0x34, 0xCE, 0x05, 0x78, 0x5E, 0xD6, + 0x85, 0xCC, 0x29, 0xB8, 0xC1, 0x0D, 0xCB, 0x80, + 0x2E, 0x04, 0x00, 0x44, 0x32, 0x95, 0xBF, 0xFE, + 0x6E, 0x7C, 0xFD, 0xA7, 0x3C, 0x5C, 0xF0, 0xEC, + 0xAC, 0xF8, 0xB9, 0xC0, 0x1B, 0x3E, 0xE8, 0x66, + 0x5D, 0xDE, 0x49, 0x71, 0xAA, 0xAF, 0x21, 0x64, + 0x28, 0x8A, 0x4E, 0x98, 0x58, 0xA2, 0x23, 0xCF, + 0x9E, 0x63, 0x61, 0x91, 0x12, 0xC6, 0x8C, 0x19, + 0xA8, 0xD4, 0xC7, 0xDD, 0xFC, 0xBD, 0x38, 0xDF, + 0xEA, 0x2D, 0x7E, 0x7D, 0xE3, 0xE0, 0xC3, 0xD9, + 0x8B, 0x11, 0xF1, 0x4D, 0xC8, 0xB5, 0x55, 0xAE, + 0xE1, 0x89, 0xE5, 0xB3, 0xBC, 0x69, 0x9D, 0xA6, + 0x09, 0x9A, 0x74, 0x35, 0x1A, 0xFB, 0x24, 0xB7, + 0x13, 0x14, 0x94, 0x0A, 0x86, 0x0F, 0x60, 0x51, + 0xB0, 0x84, 0x22, 0x5B, 0x87, 0x43, 0x57, 0x0B, + 0x2F, 0x5F, 0x02, 0xD0, 0xBB, 0xA3, 0xC9, 0x7A, + 0xBE, 0xC2, 0x26, 0x46, 0xDB, 0x1E, 0x1D, 0x92, + 0xE2, 0xB2, 0x37, 0x6D, 0xD5, 0x4A, 0x0E, 0x4B, + 0x8E, 0xC5, 0x42, 0x99, 0xEE, 0xE4, 0xB1, 0x06, + 0xAB, 0x5A, 0x56, 0x41, 0x65, 0xBA, 0xFA, 0x83, + 0x15, 0xDA, 0x72, 0xA1, 0x81, 0x1C, 0xA9, 0x36, + 0x25, 0x96, 0x6C, 0x39, 0x82, 0xE6, 0x2C, 0x9B, + 0xC4, 0x7F, 0xA0, 0xD8, 0xEF, 0x03, 0x70, 0xF6 }; + +unsigned char table_133[256] = { + 0x02, 0xF0, 0xED, 0xC4, 0xE4, 0x67, 0x60, 0x8B, + 0xF3, 0x77, 0x92, 0xE0, 0x85, 0x93, 0x1E, 0x8E, + 0x9A, 0x38, 0x61, 0x20, 0xB7, 0x68, 0xE1, 0x5E, + 0xD5, 0x63, 0xA9, 0xA5, 0xBE, 0x36, 0x12, 0x4D, + 0x86, 0x16, 0xD6, 0xB1, 0x23, 0x64, 0x4F, 0x62, + 0xFC, 0xA3, 0xD3, 0x04, 0x7D, 0x8C, 0xE2, 0xFF, + 0x5D, 0x30, 0xF5, 0x95, 0x1B, 0x5F, 0x73, 0xAA, + 0xE8, 0x07, 0x87, 0xDC, 0x54, 0x7C, 0xEE, 0x00, + 0xB8, 0xD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, 0x97, 0x28, 0x3E, 0xE5, + 0x5A, 0x35, 0xB0, 0xAE, 0x82, 0x79, 0x1D, 0x52 }; + +unsigned char table_134[32] = { + 0x09, 0x0F, 0x10, 0x0C, 0x03, 0x15, 0x07, 0x17, + 0x0E, 0x0B, 0x1D, 0x08, 0x19, 0x11, 0x00, 0x0A, + 0x01, 0x06, 0x18, 0x16, 0x0D, 0x13, 0x14, 0x12, + 0x02, 0x1B, 0x1A, 0x04, 0x05, 0x1F, 0x1C, 0x1E }; + +unsigned char table_135[256] = { + 0x14, 0x34, 0xEA, 0x02, 0x2B, 0x5A, 0x10, 0x51, + 0xF3, 0x8F, 0x28, 0xB2, 0x50, 0x8B, 0x01, 0xCC, + 0x80, 0x15, 0x29, 0x42, 0xF4, 0x1D, 0xFB, 0xBB, + 0x1F, 0x43, 0x8C, 0x17, 0x1E, 0x81, 0x04, 0x98, + 0x46, 0xD8, 0xD5, 0x65, 0x4C, 0x1C, 0xDB, 0x40, + 0x5F, 0x1A, 0x31, 0x74, 0xF1, 0x64, 0x19, 0x05, + 0xFC, 0xF0, 0x73, 0xB6, 0x23, 0x77, 0x9C, 0xCE, + 0x70, 0xEF, 0xDA, 0xE0, 0xA2, 0x78, 0x84, 0xEB, + 0x9E, 0xC5, 0x95, 0xA3, 0xF6, 0xCA, 0xAD, 0x52, + 0xD0, 0x3F, 0x54, 0xA7, 0x33, 0xA9, 0x09, 0x6A, + 0x89, 0x7E, 0x75, 0xA8, 0xD6, 0x79, 0x9F, 0xAB, + 0x8E, 0x11, 0x0E, 0x3B, 0xAA, 0xE6, 0x85, 0x53, + 0x0A, 0x59, 0xEC, 0x94, 0xD7, 0x41, 0x86, 0x7D, + 0x2F, 0xC7, 0xDE, 0x06, 0xCB, 0x13, 0xBA, 0x58, + 0xC8, 0xC9, 0x07, 0x67, 0x7F, 0xA5, 0xB4, 0x2C, + 0x48, 0x6C, 0xB8, 0xD1, 0x30, 0xD3, 0x35, 0x4F, + 0x88, 0x26, 0x93, 0x32, 0x71, 0x3E, 0x3D, 0xF7, + 0x6D, 0x03, 0xED, 0x8A, 0x36, 0x55, 0x9B, 0x66, + 0x8D, 0x27, 0x7C, 0xF9, 0xA6, 0xC3, 0x20, 0x69, + 0x4A, 0xE3, 0x99, 0x5C, 0xBC, 0x45, 0x16, 0x6B, + 0xB9, 0x49, 0x82, 0xFF, 0xBD, 0xDD, 0xE9, 0x0C, + 0xD4, 0x44, 0xFD, 0x22, 0xE5, 0xAC, 0x61, 0xC4, + 0x90, 0x47, 0x37, 0x72, 0xA4, 0x7A, 0x24, 0x4D, + 0x5B, 0x12, 0x38, 0x92, 0x87, 0x1B, 0xE1, 0xA0, + 0x91, 0x3C, 0xEE, 0x6F, 0xC1, 0x0F, 0x56, 0xC2, + 0x9A, 0xF8, 0x18, 0xE8, 0xD2, 0xDC, 0x4B, 0xCF, + 0x39, 0xF5, 0xFE, 0x2A, 0x2D, 0x9D, 0xA1, 0xFA, + 0xE7, 0xBF, 0x6E, 0xE4, 0x2E, 0xB3, 0xCD, 0xE2, + 0xAF, 0x7B, 0xC0, 0x68, 0x97, 0xB5, 0x5D, 0xB7, + 0x21, 0x57, 0x83, 0x76, 0xB1, 0xAE, 0x5E, 0x0D, + 0x96, 0x4E, 0x08, 0xC6, 0x0B, 0xDF, 0x3A, 0xB0, + 0x00, 0x63, 0xD9, 0xBE, 0xF2, 0x60, 0x25, 0x62 }; + +unsigned char table_136[256] = { + 0xD3, 0x1A, 0x00, 0xED, 0x59, 0x24, 0xA3, 0xF2, + 0xBA, 0x58, 0x4C, 0x5C, 0x75, 0x48, 0x98, 0xB0, + 0xCF, 0xC3, 0xF7, 0x88, 0x70, 0xB3, 0x3D, 0x3E, + 0x03, 0xF9, 0xC9, 0xFD, 0x80, 0x44, 0x7F, 0x3B, + 0x95, 0x5F, 0x31, 0x47, 0x15, 0x07, 0xB8, 0x08, + 0xCE, 0xDA, 0x71, 0x9F, 0x83, 0xB1, 0x55, 0x16, + 0xE6, 0xB2, 0x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, 0x0E, 0x97, 0xD9, + 0xDE, 0x46, 0x35, 0x8B, 0x8E, 0x8A, 0xF4, 0xFF, + 0x60, 0xD7, 0xE9, 0x17, 0xEB, 0x9C, 0x84, 0x0C, + 0x93, 0x1D, 0x9B, 0x5B, 0x40, 0xEE, 0x42, 0x19 }; + +unsigned char table_137[32] = { + 0x0F, 0x09, 0x02, 0x06, 0x18, 0x0B, 0x1E, 0x05, + 0x11, 0x1D, 0x16, 0x01, 0x13, 0x10, 0x0E, 0x1A, + 0x1B, 0x00, 0x0D, 0x08, 0x15, 0x14, 0x19, 0x17, + 0x03, 0x1F, 0x0A, 0x12, 0x0C, 0x07, 0x04, 0x1C }; + +unsigned char table_138[32] = { + 0x0D, 0x1C, 0x1F, 0x15, 0x0F, 0x14, 0x1B, 0x12, + 0x09, 0x0B, 0x19, 0x07, 0x11, 0x16, 0x0C, 0x04, + 0x13, 0x05, 0x1D, 0x03, 0x0E, 0x0A, 0x08, 0x1E, + 0x01, 0x06, 0x18, 0x17, 0x10, 0x1A, 0x02, 0x00 }; + +unsigned char table_139[32] = { + 0x05, 0x15, 0x1D, 0x02, 0x0F, 0x03, 0x17, 0x1A, + 0x0A, 0x00, 0x1F, 0x12, 0x0E, 0x11, 0x1B, 0x13, + 0x0B, 0x0D, 0x09, 0x18, 0x1E, 0x08, 0x14, 0x07, + 0x0C, 0x04, 0x16, 0x19, 0x1C, 0x06, 0x10, 0x01 }; + +unsigned char table_140[32] = { + 0x06, 0x1E, 0x0C, 0x11, 0x13, 0x08, 0x15, 0x01, + 0x1D, 0x03, 0x0F, 0x19, 0x18, 0x04, 0x00, 0x14, + 0x12, 0x1A, 0x0B, 0x0E, 0x02, 0x1B, 0x07, 0x05, + 0x1F, 0x17, 0x09, 0x0A, 0x0D, 0x16, 0x10, 0x1C }; + +unsigned char table_141[256] = { + 0xE1, 0x0A, 0x28, 0xCD, 0x8A, 0x1E, 0x26, 0x10, + 0xC0, 0x6F, 0x06, 0x2C, 0xF8, 0x51,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4, + 0x61, 0x44, 0x43, 0xAA, 0xB1, 0xCE, 0xE7, 0x84, + 0x00, 0x0B, 0xFB, 0x68, 0xC2, 0x3C, 0x58, 0xB2, + 0x69, 0x7F, 0x33, 0x2B, 0x80, 0x03, 0xE9, 0x88, + 0x29, 0x12, 0x01, 0x6E, 0x62, 0xF1, 0xA6, 0xF9, + 0x5D, 0xD2, 0xE3, 0x53, 0x09, 0x2D, 0xBB, 0x15, + 0xEB, 0x13, 0xA5, 0xF6, 0x73, 0x19, 0x60, 0xB0, + 0xD1, 0x48, 0x92, 0x1D, 0x52, 0x5E, 0x45, 0x70, + 0x98, 0x54, 0xB8, 0xDC, 0x46, 0xDF, 0x87, 0xE5 }; + +unsigned char table_142[256] = { + 0x90, 0x94, 0xBE, 0x14, 0x99, 0xEB, 0x45, 0x0F, + 0x34, 0x4A, 0xE3, 0x79, 0xD2, 0x64, 0x4D, 0x69, + 0x91, 0xDE, 0xB9, 0x1C, 0x59, 0x20, 0x6C, 0x0B, + 0x16, 0xC7, 0x1D, 0x18, 0x02, 0x7D, 0x13, 0xB2, + 0x7B, 0x81, 0xCF, 0x61, 0xA3, 0x33, 0x00, 0x73, + 0x5A, 0x8A, 0xA1, 0xA8, 0x31, 0xAC, 0xF0, 0x67, + 0xAE, 0xA5, 0x2A, 0x96, 0x58, 0xF4, 0xB7, 0x0E, + 0xE1, 0x54, 0x27, 0x83, 0x09, 0x85, 0xF8, 0x84, + 0xEA, 0xAD, 0x06, 0xED, 0x43, 0xFF, 0xA2, 0x6E, + 0x68, 0x46, 0x74, 0x47, 0x3C, 0xAA, 0xBC, 0x55, + 0xA7, 0xC3, 0x82, 0xDC, 0xBF, 0x38, 0x80, 0x15, + 0xF6, 0xB3, 0x92, 0x7C, 0x93, 0x3F, 0xE9, 0x4C, + 0x35, 0x30, 0x32, 0xF3, 0x88, 0xC0, 0x49, 0x6D, + 0xCE, 0x42, 0xDF, 0xFD, 0x78, 0x6A, 0x24, 0xCA, + 0xB8, 0xFC, 0xA6, 0x5F, 0x29, 0xFE, 0x0C, 0x5C, + 0x0D, 0x23, 0x8B, 0x9D, 0xD4, 0x03, 0x2C, 0x9C, + 0x77, 0xD8, 0x39, 0x8C, 0x57, 0xD5, 0xE0, 0x8F, + 0xC6, 0xB0, 0xCD, 0x48, 0xC9, 0xA0, 0xDA, 0xC8, + 0xD1, 0x5B, 0xAB, 0x37, 0x5D, 0x63, 0xAF, 0xF9, + 0x17, 0x1B, 0xE5, 0xF1, 0x36, 0xC1, 0x04, 0x26, + 0x6F, 0x9E, 0xD9, 0x2F, 0x7F, 0xB5, 0x3A, 0xD6, + 0xE6, 0x40, 0x07, 0xCB, 0x7E, 0x3E, 0xC5, 0x22, + 0xEC, 0xE2, 0xD3, 0x4E, 0x65, 0x2D, 0x70, 0xE7, + 0x10, 0x19, 0xD0, 0xEF, 0xBD, 0xC2, 0x44, 0xB4, + 0xF7, 0xA4, 0x53, 0x9F, 0x86, 0xFA, 0xE8, 0x4B, + 0x28, 0x3D, 0x9B, 0x56, 0x89, 0x6B, 0x25, 0x71, + 0x60, 0x11, 0x9A, 0x5E, 0x1A, 0x52, 0x08, 0x4F, + 0xB1, 0xDD, 0xBB, 0x98, 0xFB, 0x12, 0x3B, 0x0A, + 0x2E, 0xDB, 0x62, 0x8D, 0xC4, 0x75, 0xA9, 0x2B, + 0xE4, 0x97, 0x72, 0xF5, 0xEE, 0xF2, 0xB6, 0x21, + 0xBA, 0x7A, 0x76, 0x41, 0x50, 0x66, 0x05, 0x8E, + 0xCC, 0x1E, 0x87, 0xD7, 0x01, 0x1F, 0x51, 0x95 }; + +unsigned char table_143[32] = { + 0x0E, 0x16, 0x18, 0x11, 0x0C, 0x01, 0x12, 0x1F, + 0x08, 0x15, 0x0A, 0x06, 0x1C, 0x1E, 0x02, 0x1A, + 0x17, 0x03, 0x07, 0x13, 0x05, 0x19, 0x10, 0x0F, + 0x0D, 0x14, 0x09, 0x0B, 0x1B, 0x00, 0x1D, 0x04 }; + +unsigned char table_144[32] = { + 0x00, 0x1B, 0x17, 0x19, 0x1D, 0x11, 0x0D, 0x1A, + 0x13, 0x03, 0x1E, 0x09, 0x10, 0x0E, 0x15, 0x05, + 0x0B, 0x1C, 0x1F, 0x08, 0x0A, 0x06, 0x01, 0x0F, + 0x16, 0x14, 0x02, 0x04, 0x07, 0x18, 0x12, 0x0C }; + +unsigned char table_145[256] = { + 0xF9, 0x2C, 0x38, 0x74, 0xDA, 0x65, 0x85, 0x0E, + 0xBA, 0x64, 0xDB, 0xE3, 0xB6, 0x8B, 0x0B, 0x5E, + 0x01, 0x0F, 0x12, 0x8C, 0xD4, 0xCC, 0xB1, 0x7B, + 0xE7, 0xBC, 0x2E, 0x87, 0x84, 0x3B, 0xF8, 0x4C, + 0x8E, 0x59, 0x2D, 0xAA, 0xCE, 0x28, 0x1B, 0xEE, + 0x7F, 0x5C, 0xFB, 0x62, 0x05, 0xD9, 0xDD, 0x9D, + 0x49, 0x66, 0x82, 0x71, 0xD2, 0xC7, 0xEB, 0xCF, + 0x5B, 0x41, 0x25, 0xC8, 0x6C, 0xFF, 0x78, 0x97, + 0x0C, 0xA2, 0x50, 0x7A, 0xAF, 0x2F, 0xB0, 0x7E, + 0xBB, 0x73, 0xA0, 0x9B, 0x09, 0xDE, 0x35, 0xE9, + 0x5A, 0x70, 0x56, 0xC5, 0x81, 0x19, 0x55, 0xAB, + 0xC1, 0xB4, 0x2A, 0x30, 0x54, 0x6F, 0x3E, 0x46, + 0x5D, 0x37, 0xF5, 0x57, 0x6B, 0x7C, 0x43, 0xE1, + 0x4A, 0x3F, 0xB2, 0x4B, 0x77, 0xB5, 0x44, 0xD6, + 0x91, 0x11, 0x72, 0xE8, 0xBE, 0xA5, 0xA8, 0xD3, + 0x9A, 0x17, 0x86, 0x88, 0x16, 0x3C, 0x36, 0xD8, + 0x6E, 0x07, 0x8D, 0x5F, 0xFA, 0xF1, 0x24, 0x7D, + 0x20, 0x60, 0x0D, 0x89, 0xC9, 0x29, 0xA7, 0x2B, + 0x4E, 0x10, 0x9F, 0xE5, 0x61, 0x32, 0x3A, 0xBF, + 0x93, 0xE6, 0xF3, 0x52, 0x80, 0xC4, 0x02, 0x22, + 0xA4, 0xBD, 0xF0, 0x48, 0x51, 0xF2, 0xD7, 0x33, + 0x00, 0x53, 0x98, 0xEC, 0x47, 0x39, 0xB9, 0x90, + 0x76, 0x4F, 0x68, 0x3D, 0x9C, 0x92, 0xD5, 0xB8, + 0xAE, 0xD0, 0xF4, 0x67, 0x58, 0xC0, 0x06, 0x08, + 0x14, 0x31, 0xDC, 0xA1, 0x15, 0xDF, 0xCA, 0xE2, + 0x23, 0xFE, 0xE4, 0x8F, 0x0A, 0xFC, 0x8A, 0xA3, + 0xC6, 0xCD, 0x6A, 0x75, 0xFD, 0x42, 0xB7, 0x79, + 0x96, 0x1D, 0x63, 0x18, 0xA9, 0x1C, 0x83, 0x6D, + 0xE0, 0x34, 0x04, 0xA6, 0x13, 0xAC, 0xD1, 0xF7, + 0x26, 0xC3, 0x1F, 0x27, 0x45, 0x95, 0xCB, 0x21, + 0xED, 0x1A, 0x9E, 0x99, 0xEA, 0x40, 0x94, 0x4D, + 0x69, 0xF6, 0xEF, 0xC2, 0xAD, 0x03, 0xB3, 0x1E }; + +unsigned char table_146[256] = { + 0x1C, 0xF5, 0x16, 0xD2, 0xCC, 0xDC, 0x1E, 0x29, + 0xE3, 0x17, 0x3B, 0x66, 0x6A, 0xF7, 0x03, 0xB2, + 0x92, 0x45, 0x4D, 0xD6, 0x0C, 0x5E, 0xE6, 0x01, + 0xDE, 0xCE, 0x83, 0xFA, 0x35, 0x02, 0x85, 0xC4, + 0x2E, 0x89, 0x8D, 0xE7, 0x30, 0x93, 0xDD, 0x70, + 0x80, 0xD9, 0x6D, 0x81, 0x07, 0x8E, 0xA9, 0xA6, + 0x5F, 0xC9, 0xF3, 0x9D, 0x65, 0xE8, 0x88, 0x0B, + 0x49, 0xAA, 0xB7, 0x6C, 0x11, 0xFC, 0x6F, 0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, 0x3D, 0x31, 0x36, 0x5D, 0xA0, 0x2C, + 0x7D, 0x96, 0x76, 0x99, 0xB5, 0x48, 0x98, 0x10 }; + +unsigned char table_147[32] = { + 0x17, 0x07, 0x0D, 0x16, 0x00, 0x1B, 0x1F, 0x09, + 0x10, 0x11, 0x14, 0x0A, 0x02, 0x06, 0x13, 0x0C, + 0x08, 0x1E, 0x0F, 0x12, 0x05, 0x15, 0x19, 0x01, + 0x1C, 0x1A, 0x03, 0x18, 0x04, 0x0B, 0x1D, 0x0E }; + +unsigned char table_148[256] = { + 0xFB, 0x23, 0xBC, 0x5A, 0x8C, 0x02, 0x42, 0x3B, + 0x95, 0x0C, 0x21, 0x0E, 0x14, 0xDF, 0x11, 0xC0, + 0xDB, 0x5E, 0xD3, 0xEA, 0xCE, 0xB4, 0x32, 0x12, + 0x70, 0x68, 0xA3, 0x25, 0x5B, 0x4B, 0x47, 0xA5, + 0x84, 0x9B, 0xFA, 0xD1, 0xE1, 0x3C, 0x20, 0x93, + 0x41, 0x26, 0x81, 0x39, 0x17, 0xA4, 0xCF, 0xB9, + 0xC5, 0x5F, 0x1C, 0xB3, 0x88, 0xC2, 0x92, 0x30, + 0x0A, 0xB8, 0xA0, 0xE2, 0x50, 0x2B, 0x48, 0x1E, + 0xD5, 0x13, 0xC7, 0x46, 0x9E, 0x2A, 0xF7, 0x7E, + 0xE8, 0x82, 0x60, 0x7A, 0x36, 0x97, 0x0F, 0x8F, + 0x8B, 0x80, 0xE0, 0xEB, 0xB1, 0xC6, 0x6E, 0xAE, + 0x90, 0x76, 0xA7, 0x31, 0xBE, 0x9C, 0x18, 0x6D, + 0xAB, 0x6C, 0x7B, 0xFE, 0x62, 0x05, 0xE9, 0x66, + 0x2E, 0x38, 0xB5, 0xB2, 0xFD, 0xFC, 0x7F, 0xE3, + 0xA1, 0xF1, 0x99, 0x4D, 0x79, 0x22, 0xD2, 0x37, + 0x29, 0x01, 0x54, 0x00, 0xBD, 0x51, 0x1B, 0x07, + 0x0B, 0x4A, 0xEE, 0x57, 0xDA, 0x1A, 0x06, 0xCA, + 0xCB, 0x9A, 0xC9, 0x7D, 0xE4, 0xDC, 0xE5, 0x8D, + 0x75, 0x4F, 0xF6, 0xA2, 0x65, 0x7C, 0xD9, 0x9D, + 0x03, 0x27, 0x2D, 0x4C, 0x49, 0xD4, 0x5D, 0x3E, + 0xBA, 0x1D, 0xD8, 0x91, 0x74, 0x10, 0xF8, 0xDE, + 0xEF, 0xF0, 0x6A, 0x04, 0x72, 0x08, 0x78, 0x3A, + 0x53, 0xC4, 0x34, 0xF2, 0x64, 0xAF, 0x86, 0xC3, + 0xF3, 0x73, 0x67, 0xCC, 0x58, 0xF4, 0x96, 0xAC, + 0x3D, 0xE7, 0x15, 0x8E, 0x19, 0x61, 0xF9, 0xB6, + 0xCD, 0x87, 0xAA, 0xB0, 0x1F, 0x6F, 0xAD, 0x28, + 0xC8, 0x69, 0x56, 0xC1, 0x71, 0xED, 0xE6, 0x98, + 0x6B, 0x59, 0xB7, 0xF5, 0x2C, 0xEC, 0xA8, 0x94, + 0x89, 0xBB, 0xA9, 0xD7, 0x2F, 0x8A, 0x4E, 0xD6, + 0x33, 0x16, 0x0D, 0x83, 0x5C, 0x52, 0x85, 0xA6, + 0x40, 0x45, 0x9F, 0x44, 0x63, 0x35, 0x77, 0xFF, + 0x09, 0x43, 0xBF, 0xD0, 0x55, 0xDD, 0x3F, 0x24 }; + +unsigned char table_149[32] = { + 0x1B, 0x0B, 0x0C, 0x06, 0x1F, 0x17, 0x04, 0x1A, + 0x1E, 0x02, 0x0F, 0x16, 0x0E, 0x09, 0x10, 0x01, + 0x13, 0x19, 0x11, 0x00, 0x0A, 0x05, 0x03, 0x1C, + 0x18, 0x1D, 0x14, 0x0D, 0x07, 0x08, 0x15, 0x12 }; + +unsigned char table_150[256] = { + 0x57, 0xBC, 0x9D, 0x46, 0x14, 0xD0, 0x94, 0x95, + 0x1B, 0x12, 0xB8, 0xD4, 0x53, 0x73, 0x83, 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C, 0x6A, 0xBB, 0x2E, 0x58, 0x70, 0x7F, + 0x4E, 0x4A, 0x1C, 0x5B, 0xF0, 0xA1, 0x61, 0xF6, + 0x15, 0x33, 0xE4, 0xF9, 0x2F, 0x62, 0x1F, 0x76, + 0x32, 0xCB, 0x49, 0xFE, 0x8F, 0xD5, 0xDC, 0x66, + 0x0B, 0x3E, 0xC5, 0x21, 0xC6, 0x6C, 0x18, 0xC2, + 0x6D, 0xFF, 0x51, 0x99, 0xCF, 0xFD, 0x59, 0xA7, + 0xAA, 0x8A, 0xF2, 0x69, 0x39, 0x6F, 0x77, 0xDD, + 0x97, 0xC9, 0xF3, 0x04, 0xD8, 0xF4, 0x80, 0x44 }; + +unsigned char table_151[256] = { + 0x78, 0x6C, 0xC5, 0x0C, 0x2D, 0xA7, 0x97, 0x9C, + 0x22, 0x76, 0x3E, 0x81, 0x51, 0x47, 0x59, 0x71, + 0xB1, 0xA2, 0x4A, 0x3C, 0xB5, 0x16, 0x06, 0x95, + 0xB9, 0x01, 0xE6, 0x91, 0x96, 0x1C, 0x1B, 0xAD, + 0x61, 0x64, 0xB2, 0xE7, 0x29, 0x19, 0x52, 0x3B, + 0xFA, 0xAF, 0x30, 0xDB, 0xD4, 0x0B, 0xFE, 0x75, + 0x1F, 0xBE, 0xCB, 0xF6, 0xEA, 0x31, 0xF8, 0xD8, + 0xA3, 0x82, 0x73, 0x1D, 0x99, 0xF0, 0xCC, 0xB6, + 0x46, 0x26, 0xAA, 0x8C, 0x87, 0x90, 0x24, 0x8F, + 0x7A, 0x13, 0xEE, 0xD1, 0xA9, 0x05, 0xB3, 0xF7, + 0x02, 0x7C, 0x4C, 0x1E, 0xFF, 0xE5, 0x77, 0xAB, + 0xD6, 0x98, 0x20, 0x4D, 0xC4, 0x23, 0xF4, 0xA4, + 0x85, 0x9A, 0x8E, 0x1A, 0x0E, 0xF5, 0x15, 0x60, + 0x38, 0x72, 0xE9, 0xF1, 0xC3, 0x68, 0xF2, 0x93, + 0xD3, 0x2A, 0x48, 0x74, 0xC2, 0x57, 0xA1, 0x7D, + 0x94, 0x37, 0x92, 0x5C, 0xE1, 0x41, 0x83, 0xD5, + 0x65, 0x14, 0xA6, 0xDC, 0x44, 0x27, 0xEF, 0xD7, + 0x25, 0x10, 0x2C, 0x7F, 0x40, 0xA5, 0x55, 0xBD, + 0x2B, 0x0D, 0xD0, 0xFC, 0xDF, 0xA0, 0x04, 0x00, + 0x62, 0xB4, 0x5A, 0xEB, 0x6B, 0x84, 0x7E, 0x6A, + 0xDE, 0xED, 0x66, 0x03, 0xFB, 0x2E, 0x4F, 0x4E, + 0xBB, 0x36, 0x5B, 0x18, 0xE3, 0x69, 0x3F, 0xEC, + 0xE4, 0xD2, 0x0A, 0x34, 0x63, 0xCF, 0xA8, 0xF9, + 0x9B, 0x7B, 0x6F, 0xE8, 0x49, 0xC1, 0x09, 0x54, + 0xF3, 0x50, 0x67, 0x79, 0xC0, 0x9F, 0x8D, 0x5F, + 0x17, 0x70, 0x11, 0xC8, 0xBC, 0xC6, 0xE0, 0x35, + 0x39, 0xC7, 0x6E, 0x21, 0xBF, 0xDA, 0x6D, 0x28, + 0x0F, 0xDD, 0x33, 0xAC, 0x8A, 0x12, 0xC9, 0xCD, + 0xB8, 0x45, 0xAE, 0x32, 0xCE, 0xE2, 0x56, 0xFD, + 0x42, 0x89, 0x86, 0xCA, 0x4B, 0x3D, 0x5E, 0xBA, + 0x8B, 0x5D, 0xB0, 0xB7, 0xD9, 0x58, 0x2F, 0x08, + 0x43, 0x3A, 0x53, 0x9E, 0x80, 0x88, 0x07, 0x9D }; + +unsigned char table_152[32] = { + 0x02, 0x1A, 0x17, 0x1D, 0x01, 0x03, 0x13, 0x1E, + 0x05, 0x18, 0x06, 0x0A, 0x0C, 0x04, 0x1B, 0x00, + 0x1C, 0x09, 0x1F, 0x16, 0x07, 0x0F, 0x0B, 0x0E, + 0x14, 0x12, 0x0D, 0x10, 0x19, 0x11, 0x08, 0x15 }; + +unsigned char table_153[32] = { + 0x0E, 0x14, 0x12, 0x1E, 0x1C, 0x02, 0x06, 0x16, + 0x18, 0x0D, 0x17, 0x0C, 0x1D, 0x11, 0x08, 0x19, + 0x07, 0x0F, 0x13, 0x04, 0x03, 0x1B, 0x0B, 0x1F, + 0x1A, 0x0A, 0x05, 0x10, 0x00, 0x01, 0x15, 0x09 }; + +unsigned char table_154[256] = { + 0x27, 0x5A, 0x08, 0x5B, 0xF4, 0x39, 0x13, 0x6F, + 0x67, 0xEA, 0x22, 0xCA, 0x5C, 0xCF, 0x18, 0x7C, + 0x05, 0x87, 0x60, 0xCC, 0x40, 0xC6, 0xE8, 0x6D, + 0xF5, 0x2A, 0x2D, 0xA2, 0x8C, 0x82, 0xE9, 0xDC, + 0xD6, 0x65, 0x74, 0x8E, 0x42, 0x4F, 0x3E, 0x55, + 0xFF, 0xC7, 0x9D, 0x0F, 0x81, 0xE2, 0x4C, 0xE6, + 0xEB, 0x4D, 0x70, 0xD1, 0x49, 0x43, 0x3D, 0x69, + 0x0C, 0x45, 0x28, 0x00, 0x99, 0xAE, 0xEC, 0xB8, + 0xC3, 0x17, 0x93, 0x8D, 0x36, 0x3C, 0x46, 0x2B, + 0x29, 0xC5, 0xB4, 0xB1, 0xD0, 0x0D, 0xAD, 0xFE, + 0xE5, 0xA8, 0x3B, 0x1A, 0x2C, 0xDF, 0x07, 0x86, + 0xB0, 0xD3, 0x7A, 0x59, 0x79, 0x8B, 0xC1, 0x9A, + 0x30, 0xDB, 0x24, 0xF3, 0xD8, 0x04, 0x25, 0xC2, + 0xA3, 0x98, 0x96, 0x7B, 0x71, 0x4E, 0x5E, 0x58, + 0xA5, 0x51, 0x88, 0xDA, 0xF8, 0xC0, 0x7D, 0xF6, + 0x31, 0x5F, 0x09, 0x16, 0x21, 0x62, 0x01, 0x64, + 0x9B, 0x3A, 0x2F, 0x61, 0x19, 0xA1, 0xB7, 0xE0, + 0xB9, 0x12, 0xA0, 0xBA, 0x6E, 0x8A, 0xFB, 0xD9, + 0x38, 0x1B, 0xD5, 0xB3, 0x10, 0xED, 0xE4, 0x6A, + 0x32, 0xBD, 0x75, 0xD4, 0x1C, 0xFD, 0x73, 0x77, + 0x54, 0xC8, 0x97, 0x47, 0x35, 0x94, 0xE3, 0xCD, + 0x6B, 0xBB, 0xF9, 0xAC, 0x11, 0x14, 0xAF, 0x78, + 0x3F, 0xCE, 0x26, 0x44, 0xEE, 0xFC, 0x15, 0x66, + 0x4B, 0xA6, 0x20, 0x23, 0xBE, 0x84, 0x1D, 0x7E, + 0x0B, 0x56, 0x92, 0x0A, 0xFA, 0xF7, 0x48, 0x33, + 0x9E, 0x8F, 0xAB, 0x5D, 0x41, 0x50, 0xA4, 0x7F, + 0x80, 0x4A, 0x68, 0x06, 0x2E, 0x6C, 0xC4, 0x02, + 0x0E, 0x63, 0xF0, 0xC9, 0x91, 0xB2, 0xD2, 0x03, + 0x37, 0xEF, 0x9C, 0x90, 0x83, 0x76, 0x1E, 0xA9, + 0x85, 0xB6, 0x57, 0xD7, 0xF2, 0xF1, 0xE7, 0xDE, + 0xCB, 0xAA, 0xBF, 0x89, 0x1F, 0xA7, 0xBC, 0x9F, + 0x53, 0xE1, 0xDD, 0x72, 0x95, 0x52, 0x34, 0xB5 }; + +unsigned char table_155[256] = { + 0x75, 0x58, 0xC5, 0xA5, 0x83, 0x16, 0xF3, 0x7F, + 0x94, 0xDE, 0xA0, 0xF6, 0xFD, 0x89, 0xA8, 0x06, + 0x98, 0x01, 0xD9, 0x69, 0xB7, 0x0F, 0xEA, 0x73, + 0x32, 0xF0, 0x49, 0xBF, 0x02, 0xE7, 0x22, 0x3F, + 0xDB, 0x30, 0x5F, 0x20, 0x6A, 0x93, 0x07, 0xBC, + 0x09, 0x0D, 0x37, 0x24, 0x90, 0x15, 0x80, 0xAF, + 0x8F, 0x59, 0x28, 0xFF, 0x6D, 0x1E, 0x52, 0x62, + 0xE2, 0xDD, 0x85, 0x48, 0xB5, 0xAB, 0x68, 0xAC, + 0x7E,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 0x7B, 0x9E, 0xCB, 0xED, 0x0E, + 0x8B, 0x33, 0xFC, 0xBB, 0x00, 0xA2, 0xDF, 0xDA }; + +unsigned char table_156[256] = { + 0x31, 0x25, 0xB1, 0xD3, 0xAF, 0xAE, 0x84, 0x2C, + 0x71, 0x5E, 0xD8, 0x80, 0x6F, 0x3E, 0x48, 0x86, + 0xED, 0x54, 0x6A, 0xC3, 0xBC, 0xBF, 0x0E, 0xEA, + 0x10, 0xA2, 0x9D, 0x91, 0x32, 0xE2, 0x7E, 0x1B, + 0x49, 0x27, 0xFF, 0xDD, 0x8A, 0x2F, 0x8D, 0x38, + 0xFA, 0x3C, 0x03, 0x14, 0x0F, 0x89, 0xCC, 0x07, + 0x1A, 0xA0, 0x97, 0x37, 0xA6, 0xD6, 0x63, 0x87, + 0xA1, 0xC2, 0x4B, 0x39, 0xCB, 0xCF, 0x69, 0x4E, + 0xC9, 0x28, 0x1C, 0xBB, 0x42, 0x2B, 0xA9, 0x78, + 0x5B, 0xF6, 0xE0, 0xD0, 0x5F, 0x46, 0x98, 0xCE, + 0x1F, 0x7A, 0x34, 0x8B, 0xFD, 0x9B, 0xEF, 0x74, + 0x05, 0xF2, 0x02, 0xC6, 0xDF, 0x73, 0x5C, 0x8E, + 0xDE, 0x88, 0x57, 0x3B, 0x85, 0xBD, 0xC0, 0x3A, + 0x45, 0x4D, 0x2D, 0x72, 0x0C, 0x60, 0xCA, 0x5D, + 0x06, 0x04, 0x3D, 0x51, 0x15, 0xAD, 0xE8, 0x67, + 0xBA, 0x43, 0x7D, 0xF8, 0xB2, 0xE6, 0xAB, 0xF4, + 0x23, 0x6E, 0xF0, 0x6B, 0x0B, 0x2E, 0xC8, 0xC4, + 0x4F, 0xA8, 0x6D, 0x26, 0xE9, 0x9C, 0x22, 0xB7, + 0x00, 0xB3, 0x0A, 0x7C, 0x44, 0x55, 0x75, 0xD5, + 0xAA, 0x66, 0x56, 0x24, 0x83, 0x90, 0xA4, 0xF5, + 0xCD, 0xEC, 0x18, 0xDC, 0xFE, 0x96, 0xA3, 0xF7, + 0xD2, 0xFB, 0xD1, 0x65, 0xC5, 0x08, 0x7B, 0x70, + 0x16, 0x9A, 0x20, 0x09, 0x29, 0xDA, 0x52, 0x5A, + 0x59, 0xB4, 0x77, 0x62, 0x9E, 0x19, 0x7F, 0x82, + 0x4C, 0xB6, 0x0D, 0x58, 0xEE, 0x1D, 0xB9, 0x93, + 0x50, 0xD9, 0x30, 0xE4, 0x13, 0x01, 0x36, 0x8F, + 0x53, 0x3F, 0x64, 0xA5, 0xB5, 0xD7, 0x81, 0x41, + 0x17, 0xE5, 0x94, 0xE3, 0xF9, 0x61, 0x76, 0xE1, + 0x9F, 0xFC, 0x1E, 0x12, 0xDB, 0x21, 0x79, 0x2A, + 0xAC, 0xF3, 0x6C, 0xC1, 0x95, 0x92, 0xEB, 0xA7, + 0x11, 0xC7, 0xB8, 0x4A, 0x33, 0xB0, 0x99, 0xE7, + 0xF1, 0x68, 0xBE, 0x35, 0x40, 0x8C, 0xD4, 0x47 }; + +unsigned char table_157[32] = { + 0x00, 0x0D, 0x03, 0x02, 0x11, 0x04, 0x18, 0x0B, + 0x14, 0x1D, 0x1C, 0x13, 0x1B, 0x17, 0x10, 0x15, + 0x01, 0x19, 0x07, 0x09, 0x1A, 0x16, 0x12, 0x1E, + 0x08, 0x06, 0x0C, 0x0E, 0x1F, 0x0F, 0x0A, 0x05 }; + +unsigned char table_158[256] = { + 0x68, 0x26, 0x80, 0x0B, 0xB8, 0xD5, 0x8C, 0xB7, + 0x65, 0xEF, 0xBC, 0x94, 0x28, 0xB9, 0xB2, 0xD2, + 0x92, 0xA4, 0x55, 0x27, 0xE0, 0x40, 0x6C, 0x41, + 0x25, 0xBD, 0xAF, 0xEA, 0xB1, 0x19, 0xA5, 0xC9, + 0x0E, 0xED, 0xB4, 0xF9, 0x8B, 0x6A, 0xAE, 0xD8, + 0x64, 0x83, 0xC1, 0xD3, 0x04, 0xF4, 0xFA, 0xC3, + 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x50, 0x8D, 0x89, 0x97, 0x1E, + 0xFC, 0x60, 0x12, 0x42, 0x9C, 0xF0, 0x34, 0xD7, + 0xD1, 0x1F, 0x0A, 0x21, 0xA9, 0x6E, 0xC4, 0xBA, + 0x9A, 0x57, 0xA2, 0x74, 0xC6, 0xFE, 0x9B, 0x58 }; + +unsigned char table_159[256] = { + 0xE5, 0xBF, 0x84, 0x56, 0xD6, 0x43, 0x3E, 0xA5, + 0x64, 0x87, 0x44, 0x63, 0x4A, 0x4C, 0x8D, 0x24, + 0x1C, 0xDA, 0x89, 0x52, 0x80, 0x4F, 0xE4, 0xBC, + 0xC5, 0xF4, 0x27, 0x75, 0x9C, 0xF0, 0xE1, 0x06, + 0x99, 0x48, 0xF2, 0x57, 0x34, 0x9A, 0xA8, 0x62, + 0xC9, 0xD5, 0x16, 0x6D, 0x55, 0xFA, 0x37, 0x5A, + 0x2A, 0xC6, 0x45, 0xDD, 0x1B, 0x76, 0x50, 0xE2, + 0x69, 0x41, 0x6C, 0xC4, 0x3C, 0x47, 0xA9, 0x92, + 0x00, 0x3D, 0x6F, 0xE7, 0x7A, 0x3A, 0x33, 0x53, + 0xF7, 0x03, 0xA7, 0xB1, 0x15, 0x78, 0x0B, 0x67, + 0x2E, 0x21, 0xF1, 0xD4, 0xB3, 0x98, 0x60, 0x58, + 0xBB, 0x82, 0x1E, 0x70, 0x0A, 0xA2, 0x02, 0x17, + 0xFF, 0x9F, 0xD2, 0xAF, 0xC7, 0xDC, 0x68, 0x83, + 0x42, 0xCA, 0x08, 0x39, 0x20, 0xEC, 0x77, 0x96, + 0x5B, 0xAD, 0x09, 0x6B, 0x40, 0xC2, 0x91, 0x51, + 0x10, 0xD9, 0xF9, 0xC1, 0xB5, 0xDF, 0xDB, 0xC0, + 0x7D, 0xAB, 0xAE, 0x54, 0x35, 0xF3, 0xA1, 0xE6, + 0xEA, 0x14, 0xBA, 0xFC, 0xE8, 0xEB, 0xF6, 0xBD, + 0x8C, 0x72, 0x1F, 0xE9, 0xFB, 0x7C, 0xCF, 0x49, + 0xE3, 0xA3, 0x22, 0x9D, 0x46, 0x71, 0x94, 0x31, + 0x2D, 0x65, 0x2B, 0x32, 0x18, 0xB6, 0x90, 0xF8, + 0x11, 0x5F, 0xA0, 0xEF, 0xED, 0x1A, 0x25, 0x2C, + 0x3B, 0xFD, 0x2F, 0x73, 0xB9, 0x7E, 0xDE, 0xB4, + 0x97, 0x0F, 0x7F, 0x86, 0x93, 0x07, 0x19, 0xCE, + 0xE0, 0xB7, 0xEE, 0x26, 0xD1, 0x01, 0x59, 0x5C, + 0xC3, 0x79, 0x8B, 0xD3, 0x4B, 0x04, 0xD0, 0x29, + 0x0D, 0x3F, 0xB2, 0x30, 0xCC, 0x36, 0xFE, 0xB0, + 0xF5, 0x8E, 0xA6, 0x8A, 0xC8, 0xD8, 0x05, 0xB8, + 0x12, 0xBE, 0x81, 0x4D, 0x38, 0xAC, 0x1D, 0x9E, + 0x66, 0x5E, 0x7B, 0x6E, 0x0C, 0xCD, 0x6A, 0x88, + 0xAA, 0x0E, 0x61, 0x5D, 0x95, 0x4E, 0xD7, 0x74, + 0xCB, 0x9B, 0x13, 0x8F, 0xA4, 0x28, 0x23, 0x85 }; + +unsigned char table_160[256] = { + 0x35, 0x44, 0x0E, 0x92, 0x75, 0x83, 0x9D, 0x53, + 0xA5, 0x90, 0xF8, 0xF7, 0x54, 0x74, 0xDF, 0x3D, + 0x5A, 0xAA, 0xC6, 0x26, 0x7A, 0xFC, 0x79, 0x6C, + 0x56, 0xB3, 0x32, 0xE3, 0x1C, 0xF9, 0xDC, 0xE6, + 0xA2, 0x93, 0x71, 0xFF, 0x1D, 0xEB, 0xB2, 0x04, + 0x96, 0x46, 0x0C, 0x2B, 0x17, 0xEE, 0x28, 0x25, + 0xD9, 0xAE, 0x11, 0xA7, 0x40, 0x45, 0xFB, 0x80, + 0x18, 0xF1, 0xCB, 0x2E, 0x24, 0xF3, 0xEC, 0x4F, + 0xAB, 0xD7, 0xD4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DE, 0x48, 0x31, + 0xBB, 0x2C, 0xE5, 0xC3, 0x67, 0xA1, 0x10, 0xB9 }; + +unsigned char table_161[256] = { + 0x8F, 0x1A, 0x81, 0xA2, 0x2C, 0x56, 0x6D, 0xCD, + 0x4A, 0x33, 0x50, 0xE9, 0xE0, 0x12, 0x5A, 0x43, + 0x2D, 0x4F, 0xEA, 0x95, 0xFD, 0x49, 0xAB, 0xA3, + 0x79, 0x42, 0x0B, 0xB8, 0x89, 0x40, 0x71, 0x14, + 0x80, 0x55, 0xAF, 0xCF, 0x3E, 0x64, 0x8B, 0x74, + 0xBF, 0x9C, 0x24, 0x97, 0xD1, 0xBA, 0x48, 0xD2, + 0x08, 0x1F, 0xDD, 0xA7, 0xDC, 0x92, 0x30, 0x75, + 0x31, 0x37, 0x67, 0x06, 0x68, 0x72, 0x6F, 0x05, + 0x8A, 0x7C, 0x4C, 0x3C, 0x19, 0x28, 0x86, 0x3D, + 0x93, 0xDA, 0xF4, 0xC7, 0x17, 0x85, 0xAC, 0x02, + 0x78, 0x04, 0xAD, 0x03, 0x8D, 0x11, 0xC5, 0x9D, + 0x3A, 0x73, 0x82, 0x59, 0x51, 0x9F, 0x27, 0x47, + 0xE7, 0xED, 0x1E, 0xFF, 0x34, 0x01, 0x5B, 0x4B, + 0xCA, 0x6C, 0x69, 0xBB, 0x3B, 0xC4, 0x5F, 0xDF, + 0x09, 0x6B, 0x7D, 0xC9, 0x88, 0x45, 0x57, 0xD3, + 0x2A, 0x4E, 0xF1, 0xC2, 0xA9, 0xB6, 0x18, 0xD4, + 0xA0, 0x1C, 0x4D, 0x0E, 0xE5, 0xE1, 0xD7, 0xB2, + 0x0C, 0x3F, 0x00, 0x61, 0x16, 0x0D, 0x32, 0x62, + 0x58, 0x63, 0xEE, 0xEF, 0x2F, 0x5D, 0xB0, 0x20, + 0x7A, 0x10, 0xE6, 0xA1, 0xF9, 0xD8, 0x6E, 0xCB, + 0xF0, 0x9B, 0x84, 0x8E, 0xF2, 0xFE, 0xC8, 0x7F, + 0xBD, 0xF8, 0x07, 0xC6, 0x39, 0xBC, 0xCC, 0x22, + 0x54, 0x15, 0x9A, 0xA4, 0xC1, 0x2B, 0x1B, 0x25, + 0xDE, 0x6A, 0xDB, 0x90, 0xEB, 0xB7, 0xD0, 0x44, + 0xA6, 0xB9, 0xB1, 0x23, 0x9E, 0x65, 0x83, 0xFA, + 0x96, 0xB5, 0x0F, 0xF6, 0xD6, 0xE8, 0x53, 0x13, + 0x76, 0xD5, 0x35, 0x87, 0xE3, 0x38, 0xF5, 0xAE, + 0xB3, 0xCE, 0xE2, 0x70, 0xD9, 0x66, 0x5C, 0x26, + 0xC3, 0xFC, 0xF7, 0x94, 0xF3, 0xEC, 0xFB, 0x99, + 0x91, 0x77, 0xB4, 0x46, 0xA5, 0x98, 0x7B, 0x1D, + 0x52, 0x2E, 0xA8, 0x60, 0x5E, 0x29, 0x21, 0x7E, + 0xBE, 0x0A, 0x36, 0x41, 0xC0, 0x8C, 0xE4, 0xAA }; + +unsigned char table_162[256] = { + 0xF7, 0x1B, 0xC0, 0x31, 0x5A, 0x23, 0xEA, 0xE9, + 0xFB, 0x14, 0x6A, 0xE8, 0x04, 0x65, 0x5B, 0x2C, + 0x41, 0xD9, 0xEB, 0xE4, 0x8D, 0x1D, 0xCA, 0x8F, + 0x5E, 0x43, 0xAF, 0x46, 0x0A, 0x01, 0x0C, 0xB4, + 0x95, 0x52, 0x92, 0xE0, 0x10, 0x57, 0x0F, 0x71, + 0xB1, 0x26, 0xD8, 0x05, 0x69, 0x3C, 0x54, 0xDF, + 0xFF, 0x9D, 0x51, 0xA0, 0xA1, 0x0B, 0xC1, 0x20, + 0x6D, 0xFA, 0x47, 0x15, 0x09, 0xD3, 0xE1, 0xA9, + 0x66, 0x12, 0x5C, 0x49, 0x1E, 0x3B, 0xD0, 0x8B, + 0x62, 0xBD, 0x06, 0xE5, 0x00, 0x98, 0x4E, 0x32, + 0xB0, 0x2D, 0x2A, 0x7F, 0x03, 0xD5, 0x99, 0x7E, + 0xAB, 0x22, 0xC6, 0xC3, 0x2F, 0x4C, 0x33, 0x45, + 0xE3, 0x3F, 0xF9, 0xB2, 0xFE, 0x36, 0xE7, 0xF8, + 0x55, 0x0D, 0x56, 0x1F, 0x4B, 0xE6, 0x50, 0x81, + 0xCE, 0x80, 0xCD, 0x67, 0x6B, 0xCF, 0x2E, 0x9B, + 0xBC, 0xBE, 0x11, 0x75, 0x4D, 0xAC, 0x59, 0x40, + 0x85, 0x0E, 0xC9, 0x17, 0xA3, 0x60, 0xED, 0x16, + 0xA4, 0xDD, 0xEE, 0x96, 0x77, 0x83, 0x34, 0xD2, + 0xCB, 0xFC, 0x6C, 0x08, 0xEC, 0x35, 0xF2, 0x6F, + 0x3A, 0x7B, 0x21, 0x4A, 0x70, 0xEF, 0xAD, 0xDE, + 0x90, 0x9E, 0x7D, 0x64, 0x2B, 0x79, 0xF5, 0xF3, + 0x13, 0x1C, 0x7A, 0x07, 0x4F, 0x78, 0x89, 0xB6, + 0x97, 0xF1, 0xD7, 0x7C, 0x48, 0xAE, 0x39, 0xA8, + 0xA6, 0x86, 0x3E, 0x27, 0x87, 0x73, 0x82, 0x24, + 0x30, 0x74, 0x5F, 0xD1, 0x9F, 0x9C, 0x1A, 0x8C, + 0x42, 0x6E, 0x28, 0xB9, 0xF0, 0xC4, 0x68, 0x25, + 0xC5, 0xDC, 0xB8, 0x29, 0xD6, 0x84, 0x3D, 0xBB, + 0x88, 0x76, 0xFD, 0x61, 0x94, 0x91, 0xDA, 0xB7, + 0x72, 0xBA, 0xC2, 0xDB, 0xB5, 0xA5, 0xE2, 0x18, + 0xF6, 0xAA, 0x8A, 0x19, 0x63, 0x9A, 0xA7, 0xC8, + 0xD4, 0x02, 0x8E, 0x37, 0xF4, 0xB3, 0xA2, 0x53, + 0x38, 0xCC, 0x58, 0x44, 0xBF, 0x93, 0x5D, 0xC7 }; + +unsigned char table_163[32] = { + 0x1B, 0x14, 0x12, 0x15, 0x11, 0x1D, 0x17, 0x19, + 0x10, 0x09, 0x08, 0x06, 0x1A, 0x16, 0x07, 0x13, + 0x1F, 0x0B, 0x1C, 0x05, 0x0E, 0x00, 0x18, 0x0A, + 0x04, 0x01, 0x03, 0x0C, 0x0D, 0x1E, 0x02, 0x0F }; + +unsigned char table_164[32] = { + 0x15, 0x00, 0x10, 0x0B, 0x1D, 0x0A, 0x06, 0x1C, + 0x0D, 0x1F, 0x17, 0x0F, 0x03, 0x14, 0x13, 0x12, + 0x1B, 0x18, 0x08, 0x1E, 0x16, 0x09, 0x1A, 0x04, + 0x02, 0x0C, 0x0E, 0x01, 0x07, 0x19, 0x11, 0x05 }; + +unsigned char table_165[256] = { + 0x98, 0xF5, 0x1D, 0xFB, 0x13, 0x20, 0x41, 0xA3, + 0xE3, 0x76, 0x49, 0x7E, 0x60, 0xD8, 0x68, 0x30, + 0x88, 0x45, 0xD5, 0x77, 0x00, 0xC3, 0x09, 0x31, + 0x44, 0x18, 0xD4, 0x14, 0xC8, 0x1B, 0x8B, 0x38, + 0x08, 0x52, 0xD1, 0xF3, 0x69, 0x9F, 0xDA, 0x61, + 0x16, 0x1C, 0xE4, 0x7D, 0xEE, 0xD9, 0x5E, 0x4C, + 0xA7, 0xAA, 0xA6, 0xF6, 0xCF, 0xA0, 0xBA, 0x10, + 0xE2, 0xDE, 0x0F, 0xEA, 0xBC, 0x32, 0x63, 0xC0, + 0x54, 0xC5, 0xBE, 0x71, 0x80, 0x56, 0x5C, 0xA4, + 0xAD, 0x15, 0x9D, 0x11, 0x43, 0x67, 0x95, 0xAE, + 0xC6, 0xC4, 0x91, 0x9C, 0xE5, 0x37, 0xE1, 0x7A, + 0xDB, 0xEF, 0x03, 0x65, 0x86, 0x66, 0x2A, 0xB5, + 0xBF, 0xB4, 0x0D, 0xB3, 0xD7, 0x2D, 0x01, 0xEB, + 0x8C, 0xF2, 0x5A, 0x2E, 0x64, 0x25, 0x02, 0xCB, + 0x4A, 0xB0, 0xCE, 0x35, 0xA8, 0x47, 0x85, 0x33, + 0x34, 0x24, 0x23, 0x7B, 0xB6, 0x48, 0x83, 0x40, + 0x87, 0x57, 0x3C, 0xD6, 0xCD, 0x2C, 0x6D, 0xE7, + 0xBB, 0xED, 0x81, 0x5D, 0x55, 0x46, 0xDD, 0xD3, + 0x70, 0xBD, 0xB8, 0x75, 0x53, 0x6E, 0xD0, 0x99, + 0xCA, 0x58, 0xC7, 0x4B, 0x3D, 0xA5, 0x50, 0x7C, + 0x93, 0x51, 0xB7, 0xFD, 0x05, 0x3A, 0xE8, 0x8F, + 0x28, 0x74, 0x39, 0xF0, 0x7F, 0x4F, 0x06, 0x36, + 0xB2, 0x19, 0x2F, 0x1F, 0x8D, 0x0C, 0xB9, 0xFC, + 0x89, 0x21, 0x12, 0xF7, 0x3F, 0x94, 0x6F, 0xDC, + 0x3E, 0x4E, 0x3B, 0xC9, 0x07, 0x9B, 0x17, 0x9A, + 0x73, 0x6A, 0x5B, 0xA1, 0x1E, 0x8A, 0x04, 0x72, + 0x6C, 0xA2, 0xEC, 0x96, 0xFE, 0xF8, 0x84, 0xC1, + 0x79, 0x0E, 0x62, 0x90, 0x8E, 0xF4, 0x42, 0x29, + 0x92, 0x9E, 0xAC, 0x82, 0x4D, 0xAF, 0x2B, 0x6B, + 0xA9, 0xFF, 0x0A, 0xAB, 0x22, 0x5F, 0xDF, 0xD2, + 0x0B, 0x78, 0xF1, 0xE6, 0x59, 0x27, 0xC2, 0xE0, + 0x1A, 0x26, 0xCC, 0xB1, 0xF9, 0xFA, 0x97, 0xE9 }; + +unsigned char table_166[256] = { + 0xCB, 0xEA, 0x2A, 0x36, 0x6D, 0x93, 0x4E, 0xD5, + 0xBC, 0x6A, 0xD4, 0x68, 0xF7, 0x18, 0xAB, 0x8B, + 0x66, 0x95, 0x94, 0x64, 0xB7, 0x00, 0x4D, 0x97, + 0x38, 0xB3, 0xFC, 0xE1, 0xBB, 0x63, 0xF3, 0x1F, + 0x6B, 0x2C, 0x2F, 0x5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, 0x06, + 0x48, 0xC7, 0xDB, 0x29, 0xE4, 0xAD, 0x3E, 0xA1, + 0xC9, 0x4C, 0x1A, 0xCE, 0x62, 0x4F, 0x7C, 0xC8, + 0x05, 0xC4, 0xB1, 0x1E, 0x79, 0x55, 0x84, 0xB2, + 0x20, 0x31, 0x9B, 0xEC, 0xB4, 0xCF, 0x54, 0x22, + 0x1C, 0xE0, 0x51, 0x16, 0x43, 0x07, 0x0A, 0x3F }; + +unsigned char table_167[256] = { + 0x91, 0xEA, 0x4F, 0x6A, 0x6E, 0x2D, 0x27, 0x22, + 0x44, 0xA5, 0x6D, 0xE3, 0x45, 0x06, 0xE2, 0x87, + 0x9A, 0xC9, 0x2C, 0x4A, 0x93, 0x6F, 0x00, 0xEB, + 0x7C, 0x7F, 0xA2, 0xFE, 0x40, 0x3C, 0x3F, 0xC0, + 0xC7, 0xFB, 0x8B, 0xDF, 0xA3, 0x28, 0x78, 0x48, + 0x46, 0xD5, 0x70, 0x5C, 0x35, 0x4E, 0xD7, 0x3A, + 0x42, 0x47, 0x5B, 0x26, 0x8E, 0xE0, 0x21, 0xB1, + 0x77, 0x1E, 0x53, 0x4B, 0xCC, 0xE5, 0x65, 0xF6, + 0x66, 0x2A, 0xA0, 0x5E, 0x3E, 0xAD, 0xA8, 0x95, + 0x1B, 0x0D, 0x8A, 0x05, 0x68, 0x59, 0x0C, 0x38, + 0x18, 0xC3, 0x81, 0xA4, 0xFD, 0x13, 0x50, 0xCA, + 0xE8, 0xDD, 0xD9, 0x76, 0x8C, 0xC5, 0xF4, 0x17, + 0xB4, 0x3D, 0xEC, 0x0B, 0x67, 0xC6, 0x8D, 0xE1, + 0xBB, 0x7E, 0xCB, 0x10, 0x99, 0xE9, 0x39, 0xF3, + 0x75, 0xFA, 0xAC, 0x16, 0x54, 0x51, 0xBC, 0x24, + 0x58, 0x08, 0xA7, 0x0F, 0x5D, 0xBF, 0xBA, 0xE7, + 0x9D, 0x2B, 0xB5, 0x29, 0xE4, 0xCD, 0x37, 0x30, + 0x55, 0xAE, 0x1D, 0x4D, 0x94, 0x34, 0x92, 0x1C, + 0x6B, 0xBE, 0x52, 0x7B, 0x33, 0xB0, 0x0A, 0x5A, + 0x03, 0x23, 0x41, 0x49, 0x61, 0x64, 0x73, 0x97, + 0xC2, 0x9F, 0x5F, 0x07, 0x04, 0xF8, 0xC1, 0xFC, + 0x74, 0x02, 0x0E, 0x60, 0x9E, 0xD4, 0x85, 0x88, + 0xC4, 0xF5, 0x90, 0x31, 0xF7, 0xEE, 0x9B, 0xB9, + 0x20, 0xE6, 0xA6, 0x63, 0x79, 0x56, 0x62, 0xF0, + 0x2F, 0xD8, 0x4C, 0x83, 0xF9, 0x36, 0x3B, 0x84, + 0xDE, 0x57, 0xB8, 0xB7, 0x11, 0xF2, 0xC8, 0xD3, + 0xD1, 0x96, 0x19, 0x2E, 0x72, 0x9C, 0xDB, 0xB3, + 0xA1, 0xAA, 0xCE, 0x09, 0x98, 0xED, 0xA9, 0xDA, + 0xAF, 0x86, 0xD0, 0x12, 0xFF, 0xDC, 0x1F, 0xD6, + 0x01, 0xF1, 0xD2, 0x80, 0x43, 0x7A, 0x71, 0x82, + 0xB6, 0xAB, 0x89, 0xBD, 0x8F, 0xEF, 0x7D, 0xB2, + 0x14, 0x15, 0x25, 0x32, 0x6C, 0x69, 0x1A, 0xCF }; + +unsigned char table_168[256] = { + 0x28, 0xEE, 0xB1, 0xFD, 0xB3, 0xEF, 0x36, 0x8E, + 0x85, 0x5D, 0x1C, 0x53, 0x1E, 0xDA, 0xBA, 0x3C, + 0xA8, 0x90, 0x99, 0x49, 0x45, 0xE0, 0x27, 0x8D, + 0x22, 0xE4, 0x51, 0x3E, 0xAB, 0xE8, 0x70, 0xF5, + 0x81, 0xE6, 0x34, 0x29, 0xF3, 0x11, 0x46, 0x5F, + 0x5C, 0xA0, 0xD1, 0xE3, 0x15, 0x68, 0x3A, 0x01, + 0xE9, 0xD7, 0x24, 0x5A, 0x18, 0x16, 0x88,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 0xBE, 0x1D, 0xF6, 0x9B, 0x14, 0x26, 0x0A, + 0xEB, 0xF7, 0x71, 0x39, 0x30, 0xA5, 0x87, 0xD2, + 0x66, 0x2E, 0x08, 0x32, 0x4C, 0x33, 0x7E, 0xE1 }; + +unsigned char table_169[256] = { + 0xA4, 0x31, 0xA9, 0x3F, 0x13, 0x4D, 0x1B, 0x29, + 0x73, 0x43, 0xF1, 0xE7, 0x9C, 0xC2, 0xF6, 0xCD, + 0xA1, 0x94, 0x0D, 0x27, 0xFE, 0x7B, 0x9B, 0x0B, + 0x89, 0xBA, 0x23, 0xEC, 0x76, 0xC3, 0x6C, 0xD8, + 0x8D, 0xF8, 0xF9, 0x7D, 0x68, 0x5B, 0x61, 0x87, + 0x28, 0x14, 0x55, 0x0C, 0xFC, 0xD9, 0x07, 0xE8, + 0x36, 0x88, 0x67, 0x4C, 0xEA, 0xBD, 0xF5, 0x9D, + 0xB6, 0xC6, 0x24, 0x32, 0x93, 0x03, 0x79, 0x8C, + 0x12, 0x84, 0xFF, 0x7E, 0x42, 0xE4, 0x3C, 0xF2, + 0x50, 0xEB, 0x1F, 0x47, 0xB0, 0xA5, 0xB1, 0x71, + 0x30, 0x5F, 0x5C, 0x53, 0xF7, 0x10, 0xC5, 0x6E, + 0xE0, 0xDE, 0xC8, 0x58, 0xB7, 0x90, 0xA6, 0x95, + 0x70, 0x8F, 0xFD, 0xC1, 0x48, 0xB5, 0x19, 0x92, + 0xBC, 0x15, 0x4E, 0xE6, 0x11, 0xDD, 0x81, 0x0E, + 0xBB, 0x75, 0x5D, 0x4A, 0xAB, 0x2D, 0x02, 0x54, + 0x4B, 0x66, 0xD6, 0x2B, 0x2A, 0xE5, 0x26, 0xE1, + 0xEE, 0xE9, 0x8B, 0x6A, 0x7A, 0xF4, 0x51, 0x39, + 0x1C, 0xC9, 0xCF, 0x77, 0x00, 0xF3, 0x25, 0xCC, + 0x08, 0xFB, 0x0F, 0x3E, 0xCE, 0xED, 0x3D, 0x56, + 0xEF, 0x1D, 0x85, 0x96, 0x52, 0xA8, 0xD3, 0xCB, + 0xE3, 0x33, 0x06, 0x7C, 0xAE, 0x72, 0x09, 0x04, + 0x91, 0xC4, 0x5A, 0x69, 0x98, 0xB4, 0x40, 0xDF, + 0x7F, 0x9F, 0xAA, 0x83, 0xE2, 0x78, 0x74, 0x20, + 0xAD, 0x6D, 0xDC, 0xD4, 0xCA, 0x60, 0xF0, 0x35, + 0x37, 0xD0, 0x18, 0x1A, 0x64, 0x3A, 0x99, 0xDB, + 0x62, 0x44, 0x2C, 0x82, 0x8E, 0xD7, 0xD1, 0xFA, + 0x16, 0xD5, 0x46, 0xBF, 0xA7, 0xC0, 0x2E, 0x3B, + 0x01, 0x63, 0xB2, 0x1E, 0x05, 0x21, 0xB8, 0x17, + 0x22, 0x97, 0xAF, 0x4F, 0x86, 0x34, 0xDA, 0xC7, + 0xA3, 0xA0, 0xB3, 0x2F, 0xAC, 0x49, 0xD2, 0x57, + 0x6F, 0x9A, 0x65, 0xB9, 0x41, 0xBE, 0x8A, 0xA2, + 0x6B, 0x0A, 0x59, 0x9E, 0x5E, 0x38, 0x45, 0x80 }; + +unsigned char table_170[256] = { + 0xE3, 0x00, 0x99, 0x03, 0xF6, 0xDD, 0xD1, 0x41, + 0x58, 0x7E, 0xD9, 0x46, 0x04, 0xAF, 0x5C, 0x43, + 0xDE, 0x5E, 0xFC, 0x97, 0x3D, 0x68, 0xC8, 0x37, + 0x3C, 0xFB, 0x0F, 0x5A, 0xBE, 0xFA, 0x4C, 0x82, + 0x0C, 0xA0, 0x0A, 0xD4, 0x9D, 0xCE, 0x78, 0xA8, + 0x55, 0x56, 0x60, 0xAA, 0xC9, 0x96, 0x62, 0xEA, + 0x0D, 0xB8, 0xE2, 0x84, 0x17, 0xAE, 0x2B, 0x2C, + 0x91, 0x57, 0x38, 0x01, 0xA9, 0xCD, 0x34, 0xBA, + 0x8D, 0xC0, 0xD6, 0xFF, 0xF2, 0xD3, 0x5F, 0x26, + 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0x83, 0x12, 0x4D, 0x65, 0xDF }; + +unsigned char table_171[32] = { + 0x07, 0x06, 0x11, 0x08, 0x0C, 0x1F, 0x19, 0x02, + 0x14, 0x04, 0x0D, 0x18, 0x1A, 0x05, 0x17, 0x13, + 0x1C, 0x1B, 0x15, 0x03, 0x01, 0x0F, 0x16, 0x1E, + 0x1D, 0x10, 0x00, 0x12, 0x0B, 0x0E, 0x09, 0x0A }; + +unsigned char table_172[32] = { + 0x11, 0x01, 0x1F, 0x06, 0x1A, 0x04, 0x02, 0x09, + 0x05, 0x0D, 0x0B, 0x18, 0x0E, 0x12, 0x1B, 0x17, + 0x07, 0x08, 0x1D, 0x1E, 0x14, 0x19, 0x16, 0x15, + 0x03, 0x0C, 0x00, 0x10, 0x0A, 0x1C, 0x0F, 0x13 }; + +unsigned char table_173[32] = { + 0x1F, 0x0B, 0x13, 0x00, 0x16, 0x15, 0x14, 0x0A, + 0x1D, 0x05, 0x1E, 0x1A, 0x0F, 0x04, 0x0E, 0x01, + 0x19, 0x07, 0x02, 0x12, 0x0C, 0x17, 0x08, 0x09, + 0x03, 0x11, 0x18, 0x10, 0x1C, 0x1B, 0x06, 0x0D }; + +unsigned char table_174[32] = { + 0x02, 0x1B, 0x0C, 0x17, 0x1F, 0x05, 0x15, 0x1E, + 0x16, 0x09, 0x1A, 0x12, 0x0F, 0x1C, 0x18, 0x0A, + 0x19, 0x10, 0x0D, 0x13, 0x04, 0x11, 0x08, 0x14, + 0x1D, 0x0E, 0x06, 0x00, 0x01, 0x07, 0x0B, 0x03 }; + +unsigned char table_175[32] = { + 0x00, 0x06, 0x0B, 0x08, 0x0C, 0x04, 0x1A, 0x1C, + 0x05, 0x1E, 0x14, 0x03, 0x0A, 0x18, 0x12, 0x1D, + 0x16, 0x1F, 0x07, 0x09, 0x0F, 0x0E, 0x17, 0x13, + 0x11, 0x19, 0x10, 0x0D, 0x1B, 0x02, 0x01, 0x15 }; + +unsigned char table_176[32] = { + 0x12, 0x03, 0x1A, 0x15, 0x04, 0x19, 0x0B, 0x1B, + 0x17, 0x1E, 0x0D, 0x05, 0x11, 0x14, 0x1C, 0x00, + 0x18, 0x10, 0x0A, 0x06, 0x0E, 0x08, 0x02, 0x07, + 0x13, 0x09, 0x16, 0x1D, 0x0F, 0x0C, 0x01, 0x1F }; + +unsigned char table_177[256] = { + 0x5E, 0x4D, 0x76, 0xFE, 0xB5, 0x50, 0x83, 0x23, + 0x72, 0xDD, 0x93, 0x08, 0x69, 0xAD, 0xEC, 0x3B, + 0x0B, 0x9A, 0x36, 0xC9, 0xCA, 0xBE, 0xF7, 0x30, + 0x19, 0x39, 0x2C, 0xAB, 0xE3, 0x7B, 0xBC, 0x32, + 0xA0, 0xE4, 0xA6, 0xB6, 0xCB, 0xC8, 0x37, 0x07, + 0xD2, 0xA1, 0xD9, 0xF6, 0xBF, 0xF5, 0x88, 0x01, + 0x95, 0x0F, 0x03, 0xFD, 0xE6, 0x68, 0x90, 0x61, + 0x21, 0x6D, 0x3C, 0x62, 0x34, 0x2B, 0x71, 0x4B, + 0x44, 0x64, 0x75, 0xA2, 0x6A, 0xFF, 0x29, 0xBD, + 0x35, 0x15, 0xF9, 0xC1, 0x09, 0x45, 0xB2, 0xF2, + 0x3F, 0xCE, 0xB0, 0xC0, 0xB8, 0x00, 0x05, 0xD7, + 0x11, 0xC6, 0x78, 0x53, 0x9E, 0xB3, 0xED, 0x56, + 0x22, 0x5C, 0x9D, 0x6C, 0x99, 0x43, 0x2F, 0xAE, + 0xEB, 0x40, 0x8C, 0x1F, 0xC2, 0xDF, 0x92, 0x65, + 0x6F, 0x79, 0x5D, 0x5B, 0xAA, 0xDB, 0xF1, 0x96, + 0xD4, 0xF4, 0x8B, 0x51, 0xD5, 0xE2, 0xBB, 0x80, + 0x17, 0x7C, 0x2A, 0x6E, 0xDE, 0xEA, 0x94, 0x31, + 0xA4, 0x2D, 0xC3, 0x8D, 0x55, 0x14, 0x9B, 0x0E, + 0x7D, 0xC4, 0x06, 0x33, 0x73, 0xE9, 0x7A, 0x38, + 0x5F, 0x89, 0x84, 0xD6, 0xA8, 0x13, 0xE8, 0xCF, + 0x46, 0xD0, 0x7F, 0x24, 0x8F, 0xF8, 0x87, 0x1B, + 0x47, 0x02, 0x0C, 0x97, 0x52, 0xFB, 0x8E, 0x20, + 0x70, 0x3E, 0x7E, 0xD1, 0xE5, 0xEE, 0xCC, 0x91, + 0x74, 0xCD, 0x42, 0x04, 0x8A, 0xEF, 0xE1, 0x10, + 0x4F, 0x1C, 0x28, 0x9F, 0xD8, 0x0A, 0x18, 0x49, + 0x9C, 0x16, 0xF3, 0x82, 0x57, 0x1D, 0x26, 0x66, + 0x27, 0x86, 0xE7, 0x59, 0xFA, 0x25, 0x54, 0x0D, + 0x98, 0xDC, 0xF0, 0x3D, 0x63, 0x1E, 0x77, 0x3A, + 0xDA, 0xB7, 0x6B, 0x2E, 0x48, 0x4C, 0xBA, 0xC7, + 0x60, 0xAC, 0x1A, 0xB9, 0xFC, 0xA3, 0xA7, 0xA5, + 0xB4, 0x67, 0xA9, 0x81, 0xB1, 0x12, 0xD3, 0x85, + 0x5A, 0xC5, 0xE0, 0x58, 0x41, 0x4E, 0x4A, 0xAF }; + +unsigned char table_178[256] = { + 0x33, 0xBA, 0x98, 0xDA, 0x07, 0x2C, 0x22, 0x9B, + 0xE0, 0xED, 0xB7, 0xA1, 0x93, 0xEB, 0xDC, 0x49, + 0xDF, 0xE1, 0x6C, 0xC2, 0x64, 0x52, 0xD0, 0x8F, + 0xA2, 0x48, 0x26, 0x21, 0x6E, 0x5E, 0x0B, 0x7C, + 0x0D, 0x90, 0xA4, 0xCE, 0xF5, 0x5F, 0xF9, 0x1D, + 0x55, 0x83, 0x8D, 0xFB, 0x38, 0xB3, 0xF2, 0x67, + 0xDE, 0x0A, 0xBE, 0xEC, 0x5B, 0x35, 0x08, 0x50, + 0xE7, 0x56, 0x4A, 0x02, 0xBC, 0x5A, 0xBD, 0x43, + 0x6F, 0x79, 0xB2, 0xF7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0x4D, + 0x95, 0x9E, 0xBF, 0xEF, 0xF8, 0x45, 0x00, 0xB4 }; + +unsigned char table_179[256] = { + 0x50, 0x3D, 0x41, 0x42, 0x06, 0x5B, 0xD6, 0x34, + 0x9D, 0x3C, 0x7B, 0x14, 0xE2, 0x9B, 0x80, 0x15, + 0x51, 0x01, 0x6A, 0x30, 0xD7, 0xFC, 0x61, 0x4B, + 0x8A, 0xEC, 0x38, 0x71, 0x70, 0x2E, 0x1C, 0x72, + 0x79, 0x26, 0x4C, 0x48, 0xED, 0xAD, 0x25, 0x53, + 0x03, 0xD9, 0xB5, 0x0D, 0x8E, 0x19, 0xCC, 0xBE, + 0xE1, 0x91, 0x64, 0xA6, 0x21, 0xCE, 0x76, 0xAB, + 0x9F, 0xD1, 0xB6, 0x23, 0x6D, 0xB0, 0x90, 0xBD, + 0x09, 0x3A, 0x5E, 0xD0, 0x73, 0x10, 0x44, 0x08, + 0xFF, 0xB8, 0x24, 0x58, 0xDB, 0x65, 0x95, 0xAA, + 0xE9, 0xC4, 0x32, 0x2B, 0x84, 0xC9, 0xC7, 0xB1, + 0x4F, 0x0C, 0xCB, 0x11, 0x4E, 0x22, 0x4A, 0x16, + 0xDE, 0xBC, 0xEE, 0x68, 0x13, 0xFA, 0xC3, 0x98, + 0xEB, 0x29, 0x43, 0x9A, 0xA1, 0xE0, 0xF0, 0x3F, + 0x2F, 0x1B, 0xC2, 0x66, 0x35, 0xF5, 0xC8, 0xD8, + 0x5A, 0xE5, 0x87, 0x47, 0xD3, 0x7A, 0xE6, 0x39, + 0x77, 0x81, 0xF2, 0x0E, 0x83, 0x7E, 0x17, 0x6C, + 0xB3, 0x5C, 0xE8, 0xD2, 0xC0, 0xA4, 0xF9, 0x86, + 0xCD, 0xFB, 0x54, 0x7C, 0xBF, 0x2D, 0x82, 0xDA, + 0x96, 0x74, 0x97, 0xC5, 0x7D, 0x27, 0x57, 0x56, + 0xDC, 0xBA, 0x69, 0x8C, 0x9C, 0x88, 0xB4, 0x8D, + 0x37, 0xEA, 0x3B, 0x33, 0x2C, 0xB2, 0x45, 0xF7, + 0xC1, 0x1E, 0x46, 0x02, 0x6B, 0x3E, 0xA7, 0xD5, + 0x05, 0x0A, 0xA9, 0x1D, 0xA3, 0x4D, 0xAE, 0x6F, + 0x49, 0xDD, 0x8F, 0xEF, 0xBB, 0x67, 0x0B, 0x40, + 0x9E, 0xF1, 0x78, 0x28, 0xDF, 0x52, 0xF4, 0x92, + 0x94, 0x0F, 0xB9, 0x93, 0xF6, 0x1F, 0xAF, 0xA8, + 0xCA, 0xE4, 0x59, 0x7F, 0x85, 0x75, 0xC6, 0xFD, + 0x00, 0xB7, 0x55, 0xFE, 0x8B, 0x62, 0x5F, 0x12, + 0xF8, 0xD4, 0x89, 0xA0, 0x20, 0xE7, 0xCF, 0x60, + 0x5D, 0xAC, 0x1A, 0x36, 0x63, 0x99, 0x31, 0xF3, + 0x2A, 0x04, 0x18, 0xA5, 0xA2, 0x6E, 0x07, 0xE3 }; + +unsigned char table_180[256] = { + 0xDA, 0xCC, 0x72, 0xA6, 0xE7, 0x07, 0xFD, 0x25, + 0x92, 0x39, 0x49, 0x02, 0xD6, 0x09, 0xA8, 0x65, + 0x2E, 0x6C, 0xA1, 0x19, 0xBF, 0x21, 0x11, 0xC7, + 0x3F, 0x9F, 0xF4, 0x51, 0xAF, 0x8C, 0xFE, 0xCD, + 0x7A, 0xEB, 0x5A, 0xF7, 0x18, 0x69, 0xB9, 0xED, + 0x37, 0x45, 0x13, 0xB4, 0xAA, 0x75, 0x47, 0x42, + 0xA3, 0x81, 0x88, 0x70, 0xC1, 0x36, 0x73, 0x1D, + 0x3B, 0x22, 0xB6, 0x35, 0xE9, 0x31, 0x56, 0x23, + 0xE1, 0xF5, 0xAD, 0x46, 0x99, 0x32, 0xE4, 0x40, + 0x00, 0x0F, 0x05, 0xC6, 0x33, 0x84, 0x7B, 0x4D, + 0x4B, 0x7D, 0x91, 0x3D, 0xCE, 0x64, 0x77, 0x55, + 0xD7, 0x2B, 0x2F, 0x2C, 0xB8, 0xD3, 0x85, 0xD1, + 0xB5, 0x6A, 0xF9, 0x41, 0x08, 0xBB, 0x87, 0xEC, + 0x78, 0xE0, 0xEE, 0x8D, 0x01, 0x58, 0x15, 0x8F, + 0x06, 0xF0, 0x8B, 0x27, 0x0D, 0x0B, 0x6D, 0xBD, + 0xCA, 0x2A, 0xA2, 0xE6, 0xDD, 0xBC, 0x4E, 0x5D, + 0x74, 0x04, 0x3A, 0x96, 0x66, 0x12, 0x1E, 0xF2, + 0xF6, 0xC4, 0xAE, 0x3C, 0x0C, 0x90, 0x68, 0xD8, + 0x24, 0x5E, 0x79, 0x10, 0xAC, 0xDF, 0x9B, 0xC5, + 0x44, 0xC3, 0x50, 0x5C, 0xA5, 0x89, 0x60, 0x5F, + 0x48, 0x17, 0x34, 0xA7, 0xE2, 0xF3, 0xD9, 0x3E, + 0x9C, 0xB7, 0x7C, 0x1F, 0xA9, 0xD4, 0xA4, 0x0E, + 0x8E, 0x4C, 0xDC, 0xF8, 0xF1, 0x98, 0xDE, 0x2D, + 0x61, 0xCB, 0xD5, 0x43, 0x86, 0x26, 0xB0, 0x7F, + 0x7E, 0xFF, 0xAB, 0x83, 0x14, 0x9A, 0x80, 0x16, + 0x30, 0xA0, 0x53, 0x97, 0x52, 0x9E, 0xB1, 0x1B, + 0xD0, 0x1A, 0xC8, 0x57, 0xBA, 0x6E, 0xFA, 0x94, + 0xE8, 0x63, 0x5B, 0x29, 0xEF, 0x71, 0x8A, 0x03, + 0xB3, 0x76, 0xC9, 0xD2, 0xBE, 0xE5, 0x82, 0x1C, + 0x95, 0x9D, 0x4A, 0x28, 0xEA, 0x0A, 0xC0, 0xE3, + 0x6F, 0x20, 0x54, 0xFB, 0x93, 0xFC, 0x6B, 0x38, + 0x62, 0x4F, 0xCF, 0xB2, 0xC2, 0x59, 0xDB, 0x67 }; + +unsigned char table_181[256] = { + 0x2B, 0xED, 0x14, 0x05, 0x80, 0xCC, 0x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x11, 0x98, 0x63, 0x08, 0xE0, 0xEA, 0xBE, 0xB0, + 0x45, 0x1B, 0x4C, 0x54, 0xC8, 0x27, 0x3D, 0x73, + 0x04, 0x8F, 0x79, 0xBC, 0x6F, 0x0D, 0x0F, 0xA1, + 0x60, 0xDC, 0xC5, 0xFA, 0x8E, 0xDA, 0x15, 0x96, + 0xD3, 0x07, 0xF5, 0x3C, 0x88, 0x72, 0x1D, 0x4D, + 0x8B, 0x61, 0x0A, 0xDB, 0xAA, 0x20, 0x23, 0xEC, + 0x6E, 0x22, 0x48, 0x28, 0xBD, 0xA9, 0x56, 0x5E, + 0x85, 0xA8, 0x95, 0x6D, 0x16, 0x78, 0xB5, 0xF6, + 0x32, 0x24, 0x7D, 0x9B, 0xD2, 0x83, 0x35, 0xCD }; + +unsigned char table_182[256] = { + 0x06, 0x7F, 0x66, 0xB5, 0xBA, 0x1E, 0xFD, 0x51, + 0x81, 0x8D, 0x28, 0xA3, 0x15, 0x37, 0xDC, 0x58, + 0xE6, 0x3D, 0xB4, 0xB9, 0x2E, 0xA0, 0x2F, 0xC4, + 0xCB, 0xB1, 0x25, 0xBF, 0xC1, 0x4E, 0x5A, 0xE4, + 0x0F, 0x10, 0x7C, 0x52, 0xA7, 0x29, 0x76, 0x55, + 0xAA, 0x70, 0x62, 0x54, 0x43, 0x93, 0x3A, 0x7D, + 0x5B, 0x56, 0x33, 0x64, 0x74, 0x2A, 0xD9, 0x9B, + 0x88, 0xC0, 0x3C, 0x63, 0xDE, 0xF4, 0x73, 0xDF, + 0x9E, 0xB2, 0xA8, 0x4F, 0x04, 0x57, 0x47, 0x87, + 0x14, 0xFC, 0x27, 0x53, 0x83, 0xDB, 0xD7, 0x20, + 0x96, 0x31, 0xD0, 0xCF, 0x30, 0x19, 0x69, 0x1A, + 0xAE, 0x3B, 0x11, 0x0C, 0xA6, 0x95, 0x8A, 0xF2, + 0x1B, 0xCC, 0x78, 0xEF, 0xB3, 0x71, 0x84, 0xA2, + 0xF1, 0x7A, 0x92, 0x61, 0xCA, 0x90, 0x94, 0x89, + 0x68, 0xEE, 0x97, 0x38, 0x0D, 0xF9, 0x1F, 0x8E, + 0xE9, 0x26, 0xBD, 0xC9, 0xFF, 0x4C, 0x44, 0x1D, + 0x98, 0xE5, 0x86, 0xF3, 0x18, 0xB6, 0x09, 0xD2, + 0x7E, 0xC5, 0xE7, 0x2B, 0x8C, 0x8B, 0x60, 0x3F, + 0x2C, 0x6A, 0x08, 0x0E, 0x50, 0x32, 0x9F, 0xF0, + 0x9A, 0xC2, 0x39, 0xBE, 0xEA, 0x12, 0x16, 0xBB, + 0x5E, 0x67, 0xE3, 0xB8, 0x79, 0x46, 0xDA, 0x00, + 0xD3, 0xBC, 0xCE, 0x1C, 0x80, 0xFA, 0xAB, 0x65, + 0x4A, 0xF8, 0xAC, 0x72, 0x01, 0xC6, 0x35, 0x85, + 0x3E, 0x5C, 0xA1, 0x05, 0xA5, 0xA9, 0xE1, 0x40, + 0xEB, 0xE8, 0x5F, 0xF5, 0xC3, 0xD1, 0x34, 0xFB, + 0xEC, 0xF7, 0x9C, 0xC7, 0xDD, 0x6C, 0x36, 0x9D, + 0x42, 0x59, 0x99, 0x5D, 0xD8, 0x82, 0x07, 0x24, + 0x6D, 0xAD, 0x13, 0x48, 0x6B, 0x6E, 0x75, 0x4D, + 0xD5, 0x02, 0xED, 0xFE, 0x91, 0xCD, 0x77, 0xB0, + 0xF6, 0xC8, 0x6F, 0x23, 0xAF, 0xB7, 0x2D, 0xD6, + 0xA4, 0xE2, 0x45, 0x8F, 0x21, 0xE0, 0x49, 0x22, + 0x7B, 0x17, 0x0B, 0x0A, 0x41, 0x03, 0xD4, 0x4B }; + +unsigned char table_183[32] = { + 0x1E, 0x1B, 0x11, 0x07, 0x08, 0x06, 0x18, 0x17, + 0x0D, 0x0F, 0x12, 0x03, 0x1D, 0x04, 0x0A, 0x1A, + 0x0C, 0x13, 0x14, 0x1F, 0x0B, 0x19, 0x10, 0x01, + 0x16, 0x05, 0x1C, 0x0E, 0x02, 0x00, 0x09, 0x15 }; + +unsigned char table_184[32] = { + 0x0F, 0x1D, 0x17, 0x16, 0x0D, 0x05, 0x13, 0x1F, + 0x1B, 0x09, 0x1C, 0x1E, 0x15, 0x01, 0x06, 0x08, + 0x0C, 0x10, 0x0B, 0x02, 0x04, 0x0A, 0x07, 0x1A, + 0x18, 0x0E, 0x03, 0x11, 0x12, 0x14, 0x19, 0x00 }; + +unsigned char table_185[256] = { + 0xA5, 0xEE, 0x2E, 0x28, 0xA7, 0xAC, 0xD9, 0xB2, + 0x6E, 0x04, 0xB4, 0x03, 0xE8, 0x92, 0x5F, 0x4D, + 0x73, 0x20, 0x71, 0xE0, 0x43, 0x53, 0x3F, 0xF8, + 0x96, 0xA1, 0x24, 0x97, 0xAD, 0x7B, 0xE5, 0xE6, + 0xF2, 0xCE, 0xE3, 0x76, 0x2F, 0xA2, 0x48, 0x0E, + 0x4B, 0x4A, 0x8B, 0x5A, 0x81, 0x2C, 0xBF, 0xD7, + 0xFB, 0x7D, 0x4C, 0x16, 0xF4, 0x00, 0xF5, 0x40, + 0x64, 0x74, 0xA9, 0x37, 0x86, 0xD3, 0x1B, 0xCD, + 0xF1, 0x1A, 0x90, 0x9F, 0x54, 0x79, 0x29, 0xC3, + 0x77, 0x85, 0x02, 0xB1, 0x70, 0xFE, 0x5B, 0xDA, + 0x6B, 0x01, 0x0C, 0x07, 0xB8, 0x58, 0x47, 0x42, + 0x09, 0xE4, 0x27, 0xDD, 0xF3, 0x1E, 0x10, 0x9E, + 0x49, 0x30, 0x05, 0xBE, 0x59, 0xEB, 0xD2, 0xAA, + 0xC8, 0x9D, 0x8C, 0x5E, 0x14, 0x56, 0x8E, 0xF7, + 0x38, 0x55, 0x87, 0xA3, 0x5D, 0x41, 0x4F, 0x1F, + 0xF6, 0x0F, 0x57, 0x91, 0xAE, 0xBA, 0xB3, 0x95, + 0x9B, 0x69, 0xC1, 0x11, 0xD0, 0x25, 0x7F, 0x3B, + 0x62, 0xCF, 0xC0, 0xA0, 0xFC, 0xB6, 0x12, 0x6C, + 0xF0, 0x13, 0x93, 0xAB, 0xC6, 0x78, 0x6D, 0x88, + 0x22, 0x08, 0x2A, 0xE2, 0xB7, 0x65, 0x31, 0x3A, + 0xA6, 0x7C, 0xF9, 0xDC, 0xE7, 0xA4, 0xC9, 0x63, + 0xA8, 0x0B, 0xED, 0x50, 0x36, 0xD8, 0x3E, 0xB0, + 0x6A, 0x5C, 0x45, 0x4E, 0x23, 0x84, 0x34, 0x9A, + 0xCC, 0x3D, 0xB5, 0xEA, 0xDE, 0x75, 0xD6, 0xFF, + 0x6F, 0xC2, 0xDB, 0x8D, 0x7A, 0x1C, 0xE9, 0x61, + 0x0A, 0x1D, 0x32, 0x52, 0x3C, 0x19, 0xFA, 0xD1, + 0xD4, 0x68, 0xC7, 0x0D, 0x99, 0x83, 0xEF, 0x80, + 0x82, 0xBD, 0xD5, 0x7E, 0x39, 0x72, 0x51, 0xAF, + 0x8A, 0x2D, 0xB9, 0x89, 0xC4, 0x67, 0x35, 0xE1, + 0x44, 0x06, 0xEC, 0xCB, 0x8F, 0x17, 0xDF, 0x94, + 0x60, 0xCA, 0x26, 0xFD, 0x33, 0x46, 0x21, 0xBB, + 0x2B, 0xC5, 0x98, 0x18, 0x66, 0x15, 0x9C, 0xBC }; + +unsigned char table_186[256] = { + 0xB7, 0xFA, 0x03, 0x7C, 0x76, 0x43, 0xA7, 0x15, + 0x4B, 0x4F, 0x04, 0xAA, 0x4E, 0xD2, 0x52, 0xC8, + 0x79, 0x16, 0xF6, 0x61, 0x01, 0x5D, 0xD6, 0x47, + 0xDE, 0xC5, 0x4D, 0x2F, 0xF5, 0x29, 0x21, 0xE6, + 0x97, 0x35, 0xDC, 0x0E, 0x8B, 0xF4, 0x0F, 0xBE, + 0x30, 0x07, 0x1D, 0x46, 0x75, 0xCE, 0x56, 0x42, + 0x28, 0x93, 0x84, 0x20, 0xA5, 0xC2, 0x87, 0x45, + 0x1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, 0x3D, 0xE4, 0xC9, 0x89, 0x2D, + 0x64, 0x82, 0xC6, 0x05, 0xD8, 0xAC, 0x99, 0x9F, + 0x11, 0x3B, 0x94, 0xE8, 0x7D, 0x7B, 0xD9, 0x5A }; + +unsigned char table_187[32] = { + 0x0F, 0x04, 0x1D, 0x1B, 0x15, 0x10, 0x01, 0x0B, + 0x00, 0x17, 0x13, 0x07, 0x1E, 0x1F, 0x08, 0x0A, + 0x19, 0x09, 0x05, 0x06, 0x0C, 0x1A, 0x14, 0x16, + 0x0E, 0x18, 0x03, 0x1C, 0x12, 0x11, 0x0D, 0x02 }; + +struct yahoo_fn yahoo_fntable[5][96] = + {{{ IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }, + { IDENT, 0, 0 }}, + {{ MULADD, 0x36056CD7, 0x4387 }, + { LOOKUP, (long)table_0, 0 }, + { LOOKUP, (long)table_1, 0 }, + { BITFLD, (long)table_2, 0 }, + { LOOKUP, (long)table_3, 0 }, + { BITFLD, (long)table_4, 0 }, + { MULADD, 0x4ABB534D, 0x3769 }, + { XOR, 0x1D242DA5, 0 }, + { MULADD, 0x3C23132D, 0x339B }, + { XOR, 0x0191265C, 0 }, + { XOR, 0x3DB979DB, 0 }, + { LOOKUP, (long)table_5, 0 }, + { XOR, 0x1A550E1E, 0 }, + { XOR, 0x2F140A2D, 0 }, + { MULADD, 0x7C466A4B, 0x29BF }, + { XOR, 0x2D3F30D3, 0 }, + { MULADD, 0x7E823B21, 0x6BB3 }, + { BITFLD, (long)table_6, 0 }, + { LOOKUP, (long)table_7, 0 }, + { BITFLD, (long)table_8, 0 }, + { LOOKUP, (long)table_9, 0 }, + { BITFLD, (long)table_10, 0 }, + { LOOKUP, (long)table_11, 0 }, + { BITFLD, (long)table_12, 0 }, + { LOOKUP, (long)table_13, 0 }, + { BITFLD, (long)table_14, 0 }, + { MULADD, 0x5B756AB9, 0x7E9B }, + { LOOKUP, (long)table_15, 0 }, + { XOR, 0x1D1C4911, 0 }, + { LOOKUP, (long)table_16, 0 }, + { LOOKUP, (long)table_17, 0 }, + { XOR, 0x46BD7771, 0 }, + { XOR, 0x51AE2B42, 0 }, + { MULADD, 0x2417591B, 0x177B }, + { MULADD, 0x57F27C5F, 0x2433 }, + { LOOKUP, (long)table_18, 0 }, + { LOOKUP, (long)table_19, 0 }, + { XOR, 0x71422261, 0 }, + { BITFLD, (long)table_20, 0 }, + { MULADD, 0x58E937F9, 0x1075 }, + { LOOKUP, (long)table_21, 0 }, + { BITFLD, (long)table_22, 0 }, + { LOOKUP, (long)table_23, 0 }, + { LOOKUP, (long)table_24, 0 }, + { MULADD, 0x0B4C3D13, 0x1597 }, + { BITFLD, (long)table_25, 0 }, + { XOR, 0x0FE07D38, 0 }, + { MULADD, 0x689B4017, 0x3CFB }, + { BITFLD, (long)table_26, 0 }, + { LOOKUP, (long)table_27, 0 }, + { XOR, 0x35413DF3, 0 }, + { MULADD, 0x05B611AB, 0x570B }, + { MULADD, 0x0DA5334F, 0x3AC7 }, + { XOR, 0x47706008, 0 }, + { BITFLD, (long)table_28, 0 }, + { LOOKUP, (long)table_29, 0 }, + { BITFLD, (long)table_30, 0 }, + { XOR, 0x57611B36, 0 }, + { MULADD, 0x314C2CD1, 0x2B5B }, + { XOR, 0x1EF33946, 0 }, + { MULADD, 0x28EA041F, 0x638F }, + { LOOKUP, (long)table_31, 0 }, + { LOOKUP, (long)table_32, 0 }, + { LOOKUP, (long)table_33, 0 }, + { MULADD, 0x511537CB, 0x7135 }, + { MULADD, 0x1CF71007, 0x5E17 }, + { XOR, 0x583D4BCF, 0 }, + { LOOKUP, (long)table_34, 0 }, + { XOR, 0x373E6856, 0 }, + { MULADD, 0x4D595519, 0x1A7D }, + { LOOKUP, (long)table_35, 0 }, + { LOOKUP, (long)table_36, 0 }, + { XOR, 0x0E2A36A7, 0 }, + { LOOKUP, (long)table_37, 0 }, + { LOOKUP, (long)table_38, 0 }, + { BITFLD, (long)table_39, 0 }, + { BITFLD, (long)table_40, 0 }, + { XOR, 0x53F3604F, 0 }, + { BITFLD, (long)table_41, 0 }, + { BITFLD, (long)table_42, 0 }, + { MULADD, 0x1EDC0BA3, 0x7531 }, + { LOOKUP, (long)table_43, 0 }, + { XOR, 0x10DF1038, 0 }, + { BITFLD, (long)table_44, 0 }, + { LOOKUP, (long)table_45, 0 }, + { XOR, 0x4EDE0CAC, 0 }, + { MULADD, 0x2F076EEB, 0x5BCF }, + { XOR, 0x6D86030F, 0 }, + { XOR, 0x3F331713, 0 }, + { LOOKUP, (long)table_46, 0 }, + { MULADD, 0x41CD726F, 0x3F79 }, + { BITFLD, (long)table_47, 0 }, + { XOR, 0x0ECE0054, 0 }, + { MULADD, 0x19B32B03, 0x4AD1 }, + { BITFLD, (long)table_48, 0 }, + { BITFLD, (long)table_49, 0 }}, + {{ MULADD, 0x39731111, 0x419B }, + { XOR, 0x54F7757A, 0 }, + { BITFLD, (long)table_50, 0 }, + { BITFLD, (long)table_51, 0 }, + { LOOKUP, (long)table_52, 0 }, + { LOOKUP, (long)table_53, 0 }, + { MULADD, 0x3CC0256B, 0x7CE7 }, + { XOR, 0x79991847, 0 }, + { MULADD, 0x228F7FB5, 0x472D }, + { MULADD, 0x32DA290B, 0x7745 }, + { XOR, 0x7A28180D, 0 }, + { BITFLD, (long)table_54, 0 }, + { BITFLD, (long)table_55, 0 }, + { MULADD, 0x5C814F8B, 0x227F }, + { LOOKUP, (long)table_56, 0 }, + { MULADD, 0x0B496F6D, 0x412D }, + { XOR, 0x6F4B62DA, 0 }, + { LOOKUP, (long)table_57, 0 }, + { XOR, 0x64973977, 0 }, + { LOOKUP, (long)table_58, 0 }, + { LOOKUP, (long)table_59, 0 }, + { BITFLD, (long)table_60, 0 }, + { LOOKUP, (long)table_61, 0 }, + { LOOKUP, (long)table_62, 0 }, + { XOR, 0x6DD14C92, 0 }, + { LOOKUP, (long)table_63, 0 }, + { BITFLD, (long)table_64, 0 }, + { BITFLD, (long)table_65, 0 }, + { BITFLD, (long)table_66, 0 }, + { LOOKUP, (long)table_67, 0 }, + { XOR, 0x5E6324D8, 0 }, + { LOOKUP, (long)table_68, 0 }, + { LOOKUP, (long)table_69, 0 }, + { LOOKUP, (long)table_70, 0 }, + { BITFLD, (long)table_71, 0 }, + { XOR, 0x62745ED0, 0 }, + { MULADD, 0x102C215B, 0x0581 }, + { LOOKUP, (long)table_72, 0 }, + { LOOKUP, (long)table_73, 0 }, + { LOOKUP, (long)table_74, 0 }, + { MULADD, 0x19511111, 0x12C1 }, + { LOOKUP, (long)table_75, 0 }, + { MULADD, 0x2A6E2953, 0x6977 }, + { LOOKUP, (long)table_76, 0 }, + { XOR, 0x55CD5445, 0 }, + { BITFLD, (long)table_77, 0 }, + { BITFLD, (long)table_78, 0 }, + { MULADD, 0x646C21EB, 0x43E5 }, + { XOR, 0x71DC4898, 0 }, + { XOR, 0x167519CB, 0 }, + { XOR, 0x6D3158F8, 0 }, + { XOR, 0x7EA95BEA, 0 }, + { BITFLD, (long)table_79, 0 }, + { XOR, 0x47377587, 0 }, + { XOR, 0x2D8B6E8F, 0 }, + { MULADD, 0x5E6105DB, 0x1605 }, + { XOR, 0x65B543C8, 0 }, + { LOOKUP, (long)table_80, 0 }, + { BITFLD, (long)table_81, 0 }, + { MULADD, 0x48AF73CB, 0x0A67 }, + { XOR, 0x4FB96154, 0 }, + { LOOKUP, (long)table_82, 0 }, + { BITFLD, (long)table_83, 0 }, + { XOR, 0x622C4954, 0 }, + { BITFLD, (long)table_84, 0 }, + { XOR, 0x20D220F3, 0 }, + { XOR, 0x361D4F0D, 0 }, + { XOR, 0x2B2000D1, 0 }, + { XOR, 0x6FB8593E, 0 }, + { LOOKUP, (long)table_85, 0 }, + { BITFLD, (long)table_86, 0 }, + { XOR, 0x2B7F7DFC, 0 }, + { MULADD, 0x5FC41A57, 0x0693 }, + { MULADD, 0x17154387, 0x2489 }, + { BITFLD, (long)table_87, 0 }, + { BITFLD, (long)table_88, 0 }, + { BITFLD, (long)table_89, 0 }, + { LOOKUP, (long)table_90, 0 }, + { XOR, 0x7E221470, 0 }, + { XOR, 0x7A600061, 0 }, + { BITFLD, (long)table_91, 0 }, + { BITFLD, (long)table_92, 0 }, + { LOOKUP, (long)table_93, 0 }, + { BITFLD, (long)table_94, 0 }, + { MULADD, 0x00E813A5, 0x2CE5 }, + { MULADD, 0x3D707E25, 0x3827 }, + { MULADD, 0x77A53E07, 0x6A5F }, + { BITFLD, (long)table_95, 0 }, + { LOOKUP, (long)table_96, 0 }, + { LOOKUP, (long)table_97, 0 }, + { XOR, 0x43A73788, 0 }, + { LOOKUP, (long)table_98, 0 }, + { BITFLD, (long)table_99, 0 }, + { LOOKUP, (long)table_100, 0 }, + { XOR, 0x55F4606B, 0 }, + { BITFLD, (long)table_101, 0 }}, + {{ BITFLD, (long)table_102, 0 }, + { MULADD, 0x32CA58E3, 0x04F9 }, + { XOR, 0x11756B30, 0 }, + { MULADD, 0x218B2569, 0x5DB1 }, + { XOR, 0x77D64B90, 0 }, + { BITFLD, (long)table_103, 0 }, + { LOOKUP, (long)table_104, 0 }, + { MULADD, 0x7D1428CB, 0x3D }, + { XOR, 0x6F872C49, 0 }, + { XOR, 0x2E484655, 0 }, + { MULADD, 0x1E3349F7, 0x41F5 }, + { LOOKUP, (long)table_105, 0 }, + { BITFLD, (long)table_106, 0 }, + { XOR, 0x61640311, 0 }, + { BITFLD, (long)table_107, 0 }, + { LOOKUP, (long)table_108, 0 }, + { LOOKUP, (long)table_109, 0 }, + { LOOKUP, (long)table_110, 0 }, + { XOR, 0x007044D3, 0 }, + { BITFLD, (long)table_111, 0 }, + { MULADD, 0x5C221625, 0x576F }, + { LOOKUP, (long)table_112, 0 }, + { LOOKUP, (long)table_113, 0 }, + { XOR, 0x2D406BB1, 0 }, + { MULADD, 0x680B1F17, 0x12CD }, + { BITFLD, (long)table_114, 0 }, + { MULADD, 0x12564D55, 0x32B9 }, + { MULADD, 0x21A67897, 0x6BAB }, + { LOOKUP, (long)table_115, 0 }, + { MULADD, 0x06405119, 0x7143 }, + { XOR, 0x351D01ED, 0 }, + { MULADD, 0x46356F6B, 0x0A49 }, + { MULADD, 0x32C77969, 0x72F3 }, + { BITFLD, (long)table_116, 0 }, + { LOOKUP, (long)table_117, 0 }, + { LOOKUP, (long)table_118, 0 }, + { BITFLD, (long)table_119, 0 }, + { LOOKUP, (long)table_120, 0 }, + { BITFLD, (long)table_121, 0 }, + { MULADD, 0x74D52C55, 0x5F43 }, + { XOR, 0x26201CA8, 0 }, + { XOR, 0x7AEB3255, 0 }, + { LOOKUP, (long)table_122, 0 }, + { MULADD, 0x578F1047, 0x640B }, + { LOOKUP, (long)table_123, 0 }, + { LOOKUP, (long)table_124, 0 }, + { BITFLD, (long)table_125, 0 }, + { BITFLD, (long)table_126, 0 }, + { XOR, 0x4A1352CF, 0 }, + { MULADD, 0x4BFB6EF3, 0x704F }, + { MULADD, 0x1B4C7FE7, 0x5637 }, + { MULADD, 0x04091A3B, 0x4917 }, + { XOR, 0x270C2F52, 0 }, + { LOOKUP, (long)table_127, 0 }, + { BITFLD, (long)table_128, 0 }, + { LOOKUP, (long)table_129, 0 }, + { BITFLD, (long)table_130, 0 }, + { MULADD, 0x127549D5, 0x579B }, + { MULADD, 0x0AB54121, 0x7A47 }, + { BITFLD, (long)table_131, 0 }, + { XOR, 0x751E6E49, 0 }, + { LOOKUP, (long)table_132, 0 }, + { LOOKUP, (long)table_133, 0 }, + { XOR, 0x670C3F74, 0 }, + { MULADD, 0x6B080851, 0x7E8B }, + { XOR, 0x71CD789E, 0 }, + { XOR, 0x3EB20B7B, 0 }, + { BITFLD, (long)table_134, 0 }, + { LOOKUP, (long)table_135, 0 }, + { MULADD, 0x58A67753, 0x272B }, + { MULADD, 0x1AB54AD7, 0x4D33 }, + { MULADD, 0x07D30A45, 0x0569 }, + { MULADD, 0x737616BF, 0x70C7 }, + { LOOKUP, (long)table_136, 0 }, + { MULADD, 0x45C4485D, 0x2063 }, + { BITFLD, (long)table_137, 0 }, + { XOR, 0x2598043D, 0 }, + { MULADD, 0x223A4FE3, 0x49A7 }, + { XOR, 0x1EED619F, 0 }, + { BITFLD, (long)table_138, 0 }, + { XOR, 0x6F477561, 0 }, + { BITFLD, (long)table_139, 0 }, + { BITFLD, (long)table_140, 0 }, + { LOOKUP, (long)table_141, 0 }, + { MULADD, 0x4BC13C4F, 0x45C1 }, + { XOR, 0x3B547BFB, 0 }, + { LOOKUP, (long)table_142, 0 }, + { MULADD, 0x71406AB3, 0x7A5F }, + { XOR, 0x2F1467E9, 0 }, + { MULADD, 0x009366D1, 0x22D1 }, + { MULADD, 0x587D1B75, 0x2CA5 }, + { MULADD, 0x213A4BE7, 0x4499 }, + { MULADD, 0x62653E89, 0x2D5D }, + { BITFLD, (long)table_143, 0 }, + { MULADD, 0x4F5F3257, 0x444F }, + { MULADD, 0x4C0E2B2B, 0x19D3 }}, + {{ MULADD, 0x3F867B35, 0x7B3B }, + { MULADD, 0x32D25CB1, 0x3D6D }, + { BITFLD, (long)table_144, 0 }, + { MULADD, 0x50FA1C51, 0x5F4F }, + { LOOKUP, (long)table_145, 0 }, + { XOR, 0x05FE7AF1, 0 }, + { MULADD, 0x14067C29, 0x10C5 }, + { LOOKUP, (long)table_146, 0 }, + { MULADD, 0x4A5558C5, 0x271F }, + { XOR, 0x3C0861B1, 0 }, + { BITFLD, (long)table_147, 0 }, + { LOOKUP, (long)table_148, 0 }, + { MULADD, 0x18837C9D, 0x6335 }, + { BITFLD, (long)table_149, 0 }, + { XOR, 0x7DAB5033, 0 }, + { LOOKUP, (long)table_150, 0 }, + { MULADD, 0x03B87321, 0x7225 }, + { XOR, 0x7F906745, 0 }, + { LOOKUP, (long)table_151, 0 }, + { BITFLD, (long)table_152, 0 }, + { XOR, 0x21C46C2C, 0 }, + { MULADD, 0x2B36757D, 0x028D }, + { BITFLD, (long)table_153, 0 }, + { LOOKUP, (long)table_154, 0 }, + { XOR, 0x106B4A85, 0 }, + { XOR, 0x17640F11, 0 }, + { LOOKUP, (long)table_155, 0 }, + { XOR, 0x69E60486, 0 }, + { LOOKUP, (long)table_156, 0 }, + { MULADD, 0x3782017D, 0x05BF }, + { BITFLD, (long)table_157, 0 }, + { LOOKUP, (long)table_158, 0 }, + { XOR, 0x6BCA53B0, 0 }, + { LOOKUP, (long)table_159, 0 }, + { LOOKUP, (long)table_160, 0 }, + { LOOKUP, (long)table_161, 0 }, + { LOOKUP, (long)table_162, 0 }, + { XOR, 0x0B8236E3, 0 }, + { BITFLD, (long)table_163, 0 }, + { MULADD, 0x5EE51C43, 0x4553 }, + { BITFLD, (long)table_164, 0 }, + { LOOKUP, (long)table_165, 0 }, + { LOOKUP, (long)table_166, 0 }, + { LOOKUP, (long)table_167, 0 }, + { MULADD, 0x42B14C6F, 0x5531 }, + { XOR, 0x4A2548E8, 0 }, + { MULADD, 0x5C071D85, 0x2437 }, + { LOOKUP, (long)table_168, 0 }, + { MULADD, 0x29195861, 0x108B }, + { XOR, 0x24012258, 0 }, + { LOOKUP, (long)table_169, 0 }, + { XOR, 0x63CC2377, 0 }, + { XOR, 0x08D04B59, 0 }, + { MULADD, 0x3FD30CF5, 0x7027 }, + { XOR, 0x7C3E0478, 0 }, + { MULADD, 0x457776B7, 0x24B3 }, + { XOR, 0x086652BC, 0 }, + { MULADD, 0x302F5B13, 0x371D }, + { LOOKUP, (long)table_170, 0 }, + { MULADD, 0x58692D47, 0x0671 }, + { XOR, 0x6601178E, 0 }, + { MULADD, 0x0F195B9B, 0x1369 }, + { XOR, 0x07BA21D8, 0 }, + { BITFLD, (long)table_171, 0 }, + { BITFLD, (long)table_172, 0 }, + { XOR, 0x13AC3D21, 0 }, + { MULADD, 0x5BCF3275, 0x6E1B }, + { MULADD, 0x62725C5B, 0x16B9 }, + { MULADD, 0x5B950FDF, 0x2D35 }, + { BITFLD, (long)table_173, 0 }, + { BITFLD, (long)table_174, 0 }, + { MULADD, 0x73BA5335, 0x1C13 }, + { BITFLD, (long)table_175, 0 }, + { BITFLD, (long)table_176, 0 }, + { XOR, 0x3E144154, 0 }, + { MULADD, 0x4EED7B27, 0x38AB }, + { LOOKUP, (long)table_177, 0 }, + { MULADD, 0x627C7E0F, 0x7F01 }, + { MULADD, 0x5D7E1F73, 0x2C0F }, + { LOOKUP, (long)table_178, 0 }, + { MULADD, 0x55C9525F, 0x4659 }, + { XOR, 0x3765334C, 0 }, + { MULADD, 0x5DF66DDF, 0x7C25 }, + { LOOKUP, (long)table_179, 0 }, + { LOOKUP, (long)table_180, 0 }, + { XOR, 0x16AE5776, 0 }, + { LOOKUP, (long)table_181, 0 }, + { LOOKUP, (long)table_182, 0 }, + { BITFLD, (long)table_183, 0 }, + { BITFLD, (long)table_184, 0 }, + { LOOKUP, (long)table_185, 0 }, + { MULADD, 0x4392327B, 0x7E0D }, + { LOOKUP, (long)table_186, 0 }, + { MULADD, 0x3D8B0CB5, 0x640D }, + { MULADD, 0x32865601, 0x4D43 }, + { BITFLD, (long)table_187, 0 }}}; + +#define A( x ) (( x ) & 0xFF ) +#define B( x ) (( x ) >> 8 & 0xFF ) +#define C( x ) (( x ) >> 16 & 0xFF ) +#define D( x ) (( x ) >> 24 & 0xFF ) + +int yahoo_xfrm( int table, int depth, int seed ) +{ + struct yahoo_fn *xfrm; + int i, j, z; + unsigned int n = seed; + unsigned char *arg; + + for( i = 0; i < depth; i++ ) + { + xfrm = &yahoo_fntable[table][n % 96]; + switch( xfrm->type ) + { + case IDENT: + return seed; + case XOR: + seed ^= xfrm->arg1; + break; + case MULADD: + seed = seed * xfrm->arg1 + xfrm->arg2; + break; + case LOOKUP: + arg = (unsigned char *)xfrm->arg1; + seed = arg[A( seed )] | arg[B( seed )] << 8 | arg[C( seed )] << 16 + | arg[D( seed )] << 24; + break; + case BITFLD: + arg = (unsigned char *)xfrm->arg1; + for( j = 0, z = 0; j < 32; j++ ) + z = ((( seed >> j ) & 1 ) << arg[j] ) | ( ~( 1 << arg[j] ) & z ); + seed = z; + break; + } + if( depth - i == 1 ) + return seed; + z = (((((( A( seed ) * 0x9E3779B1 ) ^ B( seed )) * 0x9E3779B1 ) + ^ C( seed )) * 0x9E3779B1 ) ^ D( seed )) * 0x9E3779B1; + n = (((( z ^ ( z >> 8 )) >> 16 ) ^ z ) ^ ( z >> 8 )) & 0xFF; + seed *= 0x00010DCD; + } + return seed; +} diff --git a/kopete/protocols/yahoo/libkyahoo/yahoo_fn.h b/kopete/protocols/yahoo/libkyahoo/yahoo_fn.h new file mode 100644 index 00000000..9853cbee --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yahoo_fn.h @@ -0,0 +1,33 @@ +/* + * gaim + * + * Copyright (C) 2003 + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define IDENT 1 /* identify function */ +#define XOR 2 /* xor with arg1 */ +#define MULADD 3 /* multipy by arg1 then add arg2 */ +#define LOOKUP 4 /* lookup each byte in the table pointed to by arg1 */ +#define BITFLD 5 /* reorder bits according to table pointed to by arg1 */ + +struct yahoo_fn +{ + int type; + long arg1, arg2; +}; + +int yahoo_xfrm( int table, int depth, int seed ); diff --git a/kopete/protocols/yahoo/libkyahoo/yahoobuddyiconloader.cpp b/kopete/protocols/yahoo/libkyahoo/yahoobuddyiconloader.cpp new file mode 100644 index 00000000..1608cd6f --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yahoobuddyiconloader.cpp @@ -0,0 +1,108 @@ +/* + yahoobuddyiconloader.cpp - Fetches YahooBuddyIcons + + Copyright (c) 2005 by André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include "yahoobuddyiconloader.h" + +// QT Includes +#include <qfile.h> + +// KDE Includes +#include <kdebug.h> +#include <ktempfile.h> +#include <kio/global.h> +#include <kio/job.h> +#include <kio/jobclasses.h> +#include <kurl.h> +#include <kstandarddirs.h> +#include <klocale.h> + +#include "yahootypes.h" +#include "client.h" + +YahooBuddyIconLoader::YahooBuddyIconLoader( Client *c ) +: m_client( c ) +{ +} + +YahooBuddyIconLoader::~YahooBuddyIconLoader() +{ +} + +void YahooBuddyIconLoader::fetchBuddyIcon( const QString &who, KURL url, int checksum ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + KIO::TransferJob *transfer; + QString Url = url.url(); + QString ext = Url.left( Url.findRev( "?" ) ); + ext = ext.right( ext.length() - ext.findRev( "." ) ); + + transfer = KIO::get( url, false, false ); + connect( transfer, SIGNAL( result( KIO::Job* ) ), this, SLOT( slotComplete( KIO::Job* ) ) ); + connect( transfer, SIGNAL( data( KIO::Job*, const QByteArray& ) ), this, SLOT( slotData( KIO::Job*, const QByteArray& ) ) ); + + m_jobs[transfer].url = url; + m_jobs[transfer].who = who; + m_jobs[transfer].checksum = checksum; + m_jobs[transfer].file = new KTempFile( locateLocal( "tmp", "yahoobuddyicon-" ), ext ); + m_jobs[transfer].file->setAutoDelete( true ); + +} + +void YahooBuddyIconLoader::slotData( KIO::Job *job, const QByteArray& data ) +{ + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + KIO::TransferJob *transfer = static_cast< KIO::TransferJob * >(job); + + if( m_jobs[transfer].file ) + m_jobs[transfer].file->file()->writeBlock( data.data() , data.size() ); + +} + +void YahooBuddyIconLoader::slotComplete( KIO::Job *job ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + KIO::TransferJob *transfer = static_cast< KIO::TransferJob * >(job); + + if ( job->error () || transfer->isErrorPage () ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "An error occured while downloading buddy icon." << endl; + if( m_client ) + m_client->notifyError( i18n( "An error occured while downloading buddy icon (%1)" ).arg(m_jobs[transfer].url.url()), job->errorString(), Client::Info ); + } + else + { + if ( m_jobs[transfer].file ) + { + m_jobs[transfer].file->close(); + emit fetchedBuddyIcon( m_jobs[transfer].who, m_jobs[transfer].file, m_jobs[transfer].checksum ); + } + else + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Fatal Error occured. IconLoadJob has an empty KTempFile pointer." << endl; + if( m_client ) + m_client->notifyError( i18n( "Fatal Error occured while downloading buddy icon." ), i18n( "IconLoadJob has an empty KTempFile pointer." ), Client::Info ); + } + } + + m_jobs.remove( transfer ); +} + + + +#include "yahoobuddyiconloader.moc" + diff --git a/kopete/protocols/yahoo/libkyahoo/yahoobuddyiconloader.h b/kopete/protocols/yahoo/libkyahoo/yahoobuddyiconloader.h new file mode 100644 index 00000000..c1a943c2 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yahoobuddyiconloader.h @@ -0,0 +1,77 @@ +/* + yahoobuddyiconloader.h - Fetches YahooBuddyIcons + + Copyright (c) 2005 by André Duffeck <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#ifndef YAHOOBUDDYICONLOADER_ +#define YAHOOBUDDYICONLOADER_ + +// QT Includes +#include <qobject.h> +#include <qstring.h> +#include <qmap.h> + +// KDE Includes +#include <kurl.h> + +class KTempFile; +class Client; +namespace KIO { + class Job; + class TransferJob; +} + +struct IconLoadJob { + KURL url; + QString who; + int checksum; + KTempFile *file; +}; + +/** + * @author André Duffeck + * + * This class handles the download of a Buddy icon. + * If the download was succesfull it emits a signal with a pointer + * to the temporary file, the icon was stored at + */ +class YahooBuddyIconLoader : public QObject +{ + Q_OBJECT +public: + YahooBuddyIconLoader( Client *c ); + ~YahooBuddyIconLoader(); + + /** + * Add a BuddyIcon for download. + */ + void fetchBuddyIcon( const QString &who, KURL url, int checksum ); + +signals: + /** + * The account can connect to this signal and append the icon + * stored in 'file' to the apropriate contact + */ + void fetchedBuddyIcon( const QString &who, KTempFile *file, int checksum ); + +private slots: + void slotData( KIO::Job *job, const QByteArray &data ); + void slotComplete( KIO::Job *job ); + +private: + typedef QMap< KIO::TransferJob *, IconLoadJob > TransferJobMap; + TransferJobMap m_jobs; + Client *m_client; +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/yahoobytestream.cpp b/kopete/protocols/yahoo/libkyahoo/yahoobytestream.cpp new file mode 100644 index 00000000..87cf54d1 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yahoobytestream.cpp @@ -0,0 +1,140 @@ +/* + YMSG - Yahoo Protocol Knetwork Bytestream + + Copyright (C) 2004 by Till Gerken <[email protected]> + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * This library 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. * + * * + ************************************************************************* +*/ + +#include <qobject.h> +#include <kbufferedsocket.h> +#include <kdebug.h> +#include <kresolver.h> + +#include "yahoobytestream.h" + +KNetworkByteStream::KNetworkByteStream( QObject *parent, const char */*name*/ ) + : ByteStream ( parent ) +{ + kdDebug( 14181 ) << k_funcinfo << "Instantiating new KNetwork byte stream." << endl; + + // reset close tracking flag + mClosing = false; + + mSocket = new KNetwork::KBufferedSocket; + + // make sure we get a signal whenever there's data to be read + mSocket->enableRead( true ); + + // connect signals and slots + QObject::connect( mSocket, SIGNAL ( gotError ( int ) ), this, SLOT ( slotError ( int ) ) ); + QObject::connect( mSocket, SIGNAL ( connected ( const KResolverEntry& ) ), this, SLOT ( slotConnected () ) ); + QObject::connect( mSocket, SIGNAL ( closed () ), this, SLOT ( slotConnectionClosed () ) ); + QObject::connect( mSocket, SIGNAL ( readyRead () ), this, SLOT ( slotReadyRead () ) ); + QObject::connect( mSocket, SIGNAL ( bytesWritten ( int ) ), this, SLOT ( slotBytesWritten ( int ) ) ); +} + +bool KNetworkByteStream::connect( QString host, QString service ) +{ + kdDebug( 14181 ) << k_funcinfo << "Connecting to " << host << ", service " << service << endl; + + return socket()->connect( host, service ); +} + +bool KNetworkByteStream::isOpen() const +{ + // determine if socket is open + return socket()->isOpen(); +} + +void KNetworkByteStream::close () +{ + kdDebug ( 14181 ) << k_funcinfo << "Closing stream." << endl; + + // close the socket and set flag that we are closing it ourselves + mClosing = true; + socket()->close(); +} + +int KNetworkByteStream::tryWrite () +{ + // send all data from the buffers to the socket + QByteArray writeData = takeWrite(); + kdDebug( 14181 ) << k_funcinfo << "[writeData.size() = " << writeData.size() << "]" << endl; + + socket()->writeBlock( writeData.data(), writeData.size () ); + + return writeData.size(); +} + +KNetwork::KBufferedSocket *KNetworkByteStream::socket() const +{ + return mSocket; +} + +KNetworkByteStream::~KNetworkByteStream() +{ + delete mSocket; +} + +void KNetworkByteStream::slotConnected() +{ + emit connected(); +} + +void KNetworkByteStream::slotConnectionClosed() +{ + kdDebug( 14181 ) << k_funcinfo << "Socket has been closed." << endl; + + // depending on who closed the socket, emit different signals + if ( mClosing ) + { + kdDebug( 14181 ) << "..by ourselves!" << endl; + kdDebug( 14181 ) << "socket error is " << socket()->errorString( socket()->error() ) << endl; + emit connectionClosed (); + } + else + { + kdDebug( 14181 ) << "..by the other end" << endl; + emit delayedCloseFinished (); + } +} + +void KNetworkByteStream::slotReadyRead() +{ + kdDebug( 14181 ) << endl; + // stuff all available data into our buffers + QByteArray readBuffer( socket()->bytesAvailable () ); + + socket()->readBlock( readBuffer.data (), readBuffer.size () ); + + appendRead( readBuffer ); + + emit readyRead(); +} + +void KNetworkByteStream::slotBytesWritten( int bytes ) +{ + kdDebug( 14181 ) << "[int bytes]: " << bytes << endl; + emit bytesWritten(bytes); +} + +void KNetworkByteStream::slotError( int code ) +{ + kdDebug( 14181 ) << k_funcinfo << "Socket error " << code << endl; + + emit error( code ); +} + +#include "yahoobytestream.moc" + +// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off; diff --git a/kopete/protocols/yahoo/libkyahoo/yahoobytestream.h b/kopete/protocols/yahoo/libkyahoo/yahoobytestream.h new file mode 100644 index 00000000..ac8aef63 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yahoobytestream.h @@ -0,0 +1,69 @@ +/* + YMSG - Yahoo Protocol Knetwork Bytestream + + Copyright (C) 2004 by Till Gerken <[email protected]> + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * This library 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. * + * * + ************************************************************************* +*/ + +#ifndef KNETWORKBYTESTREAM_H +#define KNETWORKBYTESTREAM_H + +#include <kbufferedsocket.h> + +#include "bytestream.h" + + +/** + * Low level socket class, using KDE's KNetwork socket classes + * @author Till Gerken + */ + +class KNetworkByteStream : public ByteStream +{ + +Q_OBJECT + +public: + KNetworkByteStream ( QObject *parent = 0, const char *name = 0 ); + + ~KNetworkByteStream (); + + bool connect ( QString host, QString service ); + virtual bool isOpen () const; + virtual void close (); + + KNetwork::KBufferedSocket *socket () const; + +signals: + void connected (); + +protected: + virtual int tryWrite (); + +private slots: + void slotConnected (); + void slotConnectionClosed (); + void slotReadyRead (); + void slotBytesWritten ( int ); + void slotError ( int ); + +private: + KNetwork::KBufferedSocket *mSocket; + bool mClosing; + +}; + +#endif + +// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off; + diff --git a/kopete/protocols/yahoo/libkyahoo/yahooclientstream.cpp b/kopete/protocols/yahoo/libkyahoo/yahooclientstream.cpp new file mode 100644 index 00000000..548140b1 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yahooclientstream.cpp @@ -0,0 +1,418 @@ +/* + oscarclientstream.cpp - Kopete Oscar Protocol + + Copyright (c) 2004 Matt Rogers <[email protected]> + + Based on code Copyright (c) 2004 SuSE Linux AG <http://www.suse.com> + Based on Iris, Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + + + +#include <qapplication.h> // for qdebug +#include <qguardedptr.h> +#include <qobject.h> +#include <qptrqueue.h> +#include <qtimer.h> + +#include <kdebug.h> + +#include "bytestream.h" +#include "connector.h" +#include "coreprotocol.h" +#include "transfer.h" + +#include "yahooclientstream.h" +#include "yahootypes.h" + +void cs_dump( const QByteArray &bytes ); + +enum { + Idle, + Connecting, + Active, + Closing +}; + +enum { + Client, + Server +}; + +class ClientStream::Private +{ +public: + Private() + { + conn = 0; + bs = 0; + + username = QString::null; + password = QString::null; + server = QString::null; + haveLocalAddr = false; + doBinding = true; + + reset(); + } + void reset() + { + state = Idle; + notify = 0; + newTransfers = false; + } + + QString username; + QString password; + QString server; + bool doAuth; //send the initial login sequences to get the cookie + bool haveLocalAddr; + QHostAddress localAddr; + Q_UINT16 localPort; + bool doBinding; + + Connector *conn; + ByteStream *bs; + CoreProtocol client; + + QString defRealm; + + int mode; + int state; + int notify; + bool newTransfers; + + int errCond; + QString errText; + + QPtrQueue<Transfer> in; + + QTimer noopTimer; // used to send icq keepalive + int noop_time; +}; + +ClientStream::ClientStream(Connector *conn, QObject *parent) +:Stream(parent) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + d = new Private; + d->mode = Client; + d->conn = conn; + connect( d->conn, SIGNAL(connected()), SLOT(cr_connected()) ); + connect( d->conn, SIGNAL(error()), SLOT(cr_error()) ); + connect( &d->client, SIGNAL( outgoingData( const QByteArray& ) ), SLOT ( cp_outgoingData( const QByteArray & ) ) ); + connect( &d->client, SIGNAL( incomingData() ), SLOT ( cp_incomingData() ) ); + + d->noop_time = 0; + connect(&d->noopTimer, SIGNAL(timeout()), SLOT(doNoop())); +} + +ClientStream::~ClientStream() +{ + reset(); + delete d; +} + +void ClientStream::reset(bool all) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + d->reset(); + d->noopTimer.stop(); + + // client + if(d->mode == Client) { + + // reset connector + if(d->bs) { + d->bs->close(); + d->bs = 0; + } + d->conn->done(); + + // reset state machine + d->client.reset(); + } + if(all) + d->in.clear(); +} + +void ClientStream::connectToServer(const QString& server, bool auth) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + reset(true); + d->state = Connecting; + d->doAuth = auth; + d->server = server; + + d->conn->connectToServer( d->server ); +} + +void ClientStream::continueAfterWarning() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; +/* unneeded? + if(d->state == WaitVersion) { + d->state = Connecting; + processNext(); + } + else if(d->state == WaitTLS) { + d->state = Connecting; + processNext(); + } +*/ +} + +void ClientStream::accept() +{ + +} + +bool ClientStream::isActive() const +{ + return (d->state != Idle); +} + +bool ClientStream::isAuthenticated() const +{ + return (d->state == Active); +} + +void ClientStream::setNoopTime(int mills) +{ + d->noop_time = mills; + + if(d->state != Active) + return; + + if(d->noop_time == 0) { + d->noopTimer.stop(); + return; + } + d->noopTimer.start(d->noop_time); +} + +void ClientStream::setLocalAddr(const QHostAddress &addr, Q_UINT16 port) +{ + d->haveLocalAddr = true; + d->localAddr = addr; + d->localPort = port; +} + +int ClientStream::errorCondition() const +{ + return d->errCond; +} + +QString ClientStream::errorText() const +{ + return d->errText; +} + +void ClientStream::close() +{ + if(d->state == Active) { + d->state = Closing; +// d->client.shutdown(); + processNext(); + } + else if(d->state != Idle && d->state != Closing) { + reset(); + } +} + +bool ClientStream::transfersAvailable() const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + return ( !d->in.isEmpty() ); +} + +Transfer* ClientStream::read() +{ + if(d->in.isEmpty()) + return 0; //first from queue... + else + return d->in.dequeue(); +} + +void ClientStream::write( Transfer *request ) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + // pass to CoreProtocol for transformation into wire format + d->client.outgoingTransfer( request ); +} + +void cs_dump( const QByteArray &bytes ) +{ +#if 0 + qDebug( "contains: %i bytes ", bytes.count() ); + uint count = 0; + while ( count < bytes.count() ) + { + int dword = 0; + for ( int i = 0; i < 8; ++i ) + { + if ( count + i < bytes.count() ) + printf( "%02x ", bytes[ count + i ] ); + else + printf( " " ); + if ( i == 3 ) + printf( " " ); + } + printf(" | "); + dword = 0; + for ( int i = 0; i < 8; ++i ) + { + if ( count + i < bytes.count() ) + { + int j = bytes [ count + i ]; + if ( j >= 0x20 && j <= 0x7e ) + printf( "%2c ", j ); + else + printf( "%2c ", '.' ); + } + else + printf( " " ); + if ( i == 3 ) + printf( " " ); + } + printf( "\n" ); + count += 8; + } + printf( "\n" ); +#endif + Q_UNUSED( bytes ); +} + +void ClientStream::cp_outgoingData( const QByteArray& outgoingBytes ) +{ + // take formatted bytes from CoreProtocol and put them on the wire + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "[data size: " << outgoingBytes.size() << "]" << endl; + //cs_dump( outgoingBytes ); + d->bs->write( outgoingBytes ); +} + +void ClientStream::cp_incomingData() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + Transfer * incoming = d->client.incomingTransfer(); + if ( incoming ) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " - got a new transfer" << endl; + d->in.enqueue( incoming ); + d->newTransfers = true; + emit doReadyRead(); + } + else + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " - client signalled incomingData but none was available, state is: "<< d->client.state() << endl; +} + +/* Connector connected */ +void ClientStream::cr_connected() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + + d->bs = d->conn->stream(); + connect(d->bs, SIGNAL(connectionClosed()), SLOT(bs_connectionClosed())); + connect(d->bs, SIGNAL(delayedCloseFinished()), SLOT(bs_delayedCloseFinished())); + connect(d->bs, SIGNAL(readyRead()), SLOT(bs_readyRead())); + connect(d->bs, SIGNAL(bytesWritten(int)), SLOT(bs_bytesWritten(int))); + connect(d->bs, SIGNAL(error(int)), SLOT(bs_error(int))); + + QByteArray spare = d->bs->read(); + + QGuardedPtr<QObject> self = this; + emit connected(); + if(!self) + return; +} + +void ClientStream::cr_error() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + reset(); + emit error(ErrConnection); +} + +void ClientStream::bs_connectionClosed() +{ + reset(); + emit connectionClosed(); +} + +void ClientStream::bs_delayedCloseFinished() +{ + // we don't care about this (we track all important data ourself) +} + +void ClientStream::bs_error(int) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + // TODO +} + +void ClientStream::bs_readyRead() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + QByteArray a; + //qDebug( "size of storage for incoming data is %i bytes.", a.size() ); + a = d->bs->read(); + + //QCString cs(a.data(), a.size()+1); + //qDebug("ClientStream: recv: %d [%s]\n", a.size(), cs.data()); + //kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " recv: " << a.size() <<" bytes" <<endl; + //cs_dump( a ); + + d->client.addIncomingData(a); +} + +void ClientStream::bs_bytesWritten(int bytes) +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " written: " << bytes <<" bytes" <<endl; +} + +void ClientStream::srvProcessNext() +{ +} + +void ClientStream::doReadyRead() +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + emit readyRead(); +} + +void ClientStream::processNext() +{ + if( !d->in.isEmpty() ) + { + QTimer::singleShot(0, this, SLOT(doReadyRead())); + } +} + +bool ClientStream::handleNeed() +{ + return false; +} + + +void ClientStream::doNoop() +{ +} + +void ClientStream::handleError() +{ +} + +#include "yahooclientstream.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/yahooclientstream.h b/kopete/protocols/yahoo/libkyahoo/yahooclientstream.h new file mode 100644 index 00000000..28301843 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yahooclientstream.h @@ -0,0 +1,159 @@ +/* + oscarclientstream.h - Kopete Yahoo Protocol + + Copyright (c) 2004 Matt Rogers <[email protected]> + + Based on code Copyright (c) 2004 SuSE Linux AG <http://www.suse.com> + Based on Iris, Copyright (C) 2003 Justin Karneges + + Kopete (c) 2002-2004 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 YAHOO_CLIENTSTREAM_H +#define YAHOO_CLIENTSTREAM_H + +#include "stream.h" + +class QHostAddress; + +// forward defines +class ByteStream; +class Connector; +class Transfer; + +class ClientStream : public Stream +{ + Q_OBJECT +public: + enum Error { + ErrConnection = ErrCustom, // Connection error, ask Connector-subclass what's up + ErrNeg, // Negotiation error, see condition + ErrAuth, // Auth error, see condition + ErrBind // Resource binding error + }; + + enum Warning { + WarnOldVersion, // server uses older XMPP/Jabber "0.9" protocol // can be customised for novell versions + WarnNoTLS // there is no chance for TLS at this point + }; + + enum NegCond { + HostGone, // host no longer hosted + HostUnknown, // unknown host + RemoteConnectionFailed, // unable to connect to a required remote resource + SeeOtherHost, // a 'redirect', see errorText() for other host + UnsupportedVersion // unsupported XMPP version + }; + + enum AuthCond { + GenericAuthError, // all-purpose "can't login" error + NoMech, // No appropriate auth mech available + BadProto, // Bad SASL auth protocol + BadServ, // Server failed mutual auth + InvalidUserId, // bad user id + InvalidMech, // bad mechanism + InvalidRealm, // bad realm + MechTooWeak, // can't use mech with this authzid + NotAuthorized, // bad user, bad password, bad creditials + TemporaryAuthFailure // please try again later! + }; + + enum BindCond { + BindNotAllowed, // not allowed to bind a resource + BindConflict // resource in-use + }; + + ClientStream(Connector *conn, QObject *parent=0); + ~ClientStream(); + + void connectToServer(const QString& server, bool auth=true); + void accept(); // server + bool isActive() const; + bool isAuthenticated() const; + + // login params + void setUsername(const QString &s); + void setPassword(const QString &s); + + void setLocalAddr(const QHostAddress &addr, Q_UINT16 port); + + void close(); + + /** + * Are there any messages waiting to be read + */ + bool transfersAvailable() const; + + /** + * Read a message received from the server + */ + Transfer * read(); + + /** + * Send a message to the server + */ + void write( Transfer* request ); + + int errorCondition() const; + QString errorText() const; + + // extrahttp://bugs.kde.org/show_bug.cgi?id=85158 +/*# void writeDirect(const QString &s); // must be for debug testing*/ + void setNoopTime(int mills); + +signals: + void connected(); + void securityLayerActivated(int); + void authenticated(); // this signal is ordinarily emitted in processNext + void warning(int); + void readyRead(); //signals that there is a transfer ready to be read +public slots: + void continueAfterWarning(); + +private slots: + void cr_connected(); + void cr_error(); + /** + * collects wire ready outgoing data from the core protocol and sends + */ + void cp_outgoingData( const QByteArray& ); + /** + * collects parsed incoming data as a transfer from the core protocol and queues + */ + void cp_incomingData(); + + void bs_connectionClosed(); + void bs_delayedCloseFinished(); + void bs_error(int); // server only + void bs_readyRead(); + void bs_bytesWritten(int); + + void doNoop(); + void doReadyRead(); + +private: + class Private; + Private *d; + + void reset(bool all=false); + void processNext(); + bool handleNeed(); + void handleError(); + void srvProcessNext(); + + /** + * convert internal method representation to wire + */ + static char* encode_method(Q_UINT8 method); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/yahooconnector.cpp b/kopete/protocols/yahoo/libkyahoo/yahooconnector.cpp new file mode 100644 index 00000000..0e163de8 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yahooconnector.cpp @@ -0,0 +1,111 @@ + +/*************************************************************************** + gwconnector.cpp - Socket Connector for KNetwork + ------------------- + begin : Wed Jul 7 2004 + copyright : (C) 2004 by Till Gerken <[email protected]> + + Kopete (C) 2004 Kopete developers <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program 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.1 of the * + * License, or (at your option) any later version. * + * * + ***************************************************************************/ + +#include <kbufferedsocket.h> +#include <kdebug.h> +#include <kresolver.h> + +#include "yahooconnector.h" +#include "yahoobytestream.h" +#include "yahootypes.h" + +KNetworkConnector::KNetworkConnector( QObject *parent, const char */*name*/ ) + : Connector( parent ) +{ + kdDebug( YAHOO_RAW_DEBUG ) << k_funcinfo << "New KNetwork connector." << endl; + + mErrorCode = KNetwork::KSocketBase::NoError; + + mByteStream = new KNetworkByteStream( this ); + + connect( mByteStream, SIGNAL ( connected () ), this, SLOT ( slotConnected () ) ); + connect( mByteStream, SIGNAL ( error ( int ) ), this, SLOT ( slotError ( int ) ) ); + mPort = 5510; +} + +KNetworkConnector::~KNetworkConnector() +{ + delete mByteStream; +} + +void KNetworkConnector::connectToServer( const QString &server ) +{ + Q_UNUSED( server ); + kdDebug( YAHOO_RAW_DEBUG ) << k_funcinfo << "Initiating connection to " << mHost << endl; + Q_ASSERT( !mHost.isNull() ); + Q_ASSERT( mPort ); + + mErrorCode = KNetwork::KSocketBase::NoError; + + if ( !mByteStream->connect( mHost, QString::number (mPort) ) ) + { + // Houston, we have a problem + mErrorCode = mByteStream->socket()->error(); + emit error(); + } +} + +void KNetworkConnector::slotConnected() +{ + kdDebug( YAHOO_RAW_DEBUG ) << k_funcinfo << "We are connected." << endl; + + // FIXME: setPeerAddress() is something different, find out correct usage later + //KInetSocketAddress inetAddress = mStreamSocket->address().asInet().makeIPv6 (); + //setPeerAddress ( QHostAddress ( inetAddress.ipAddress().addr () ), inetAddress.port () ); + + emit connected (); +} + +void KNetworkConnector::slotError( int code ) +{ + kdDebug( YAHOO_RAW_DEBUG ) << k_funcinfo << "Error detected: " << code << endl; + + mErrorCode = code; + emit error (); +} + +int KNetworkConnector::errorCode() +{ + return mErrorCode; +} + +ByteStream *KNetworkConnector::stream() const +{ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << endl; + return mByteStream; +} + +void KNetworkConnector::done() +{ + kdDebug ( YAHOO_RAW_DEBUG ) << k_funcinfo << endl; + mByteStream->close (); +} + +void KNetworkConnector::setOptHostPort( const QString &host, Q_UINT16 port ) +{ + kdDebug ( YAHOO_RAW_DEBUG ) << k_funcinfo << "Manually specifying host " << host << " and port " << port << endl; + + mHost = host; + mPort = port; + +} + +#include "yahooconnector.moc" + +// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off; diff --git a/kopete/protocols/yahoo/libkyahoo/yahooconnector.h b/kopete/protocols/yahoo/libkyahoo/yahooconnector.h new file mode 100644 index 00000000..09070d87 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yahooconnector.h @@ -0,0 +1,67 @@ + +/*************************************************************************** + oscarconnector.h - Socket Connector for KNetwork + ------------------- + begin : Wed Jul 7 2004 + copyright : (C) 2004 by Till Gerken <[email protected]> + (C) 2004 by Matt Rogers <[email protected]> + + Kopete (C) 2004 Kopete developers <[email protected]> + ***************************************************************************/ + +/*************************************************************************** + * * + * This program 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.1 of the * + * License, or (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef YAHOOCONNECTOR_H +#define YAHOOCONNECTOR_H + +#include "connector.h" + +class ByteStream; +class KNetworkByteStream; +class KResolverEntry; + +/** +@author Till Gerken +@author Matt Rogers +*/ +class KNetworkConnector : public Connector +{ + +Q_OBJECT + +public: + KNetworkConnector( QObject *parent = 0, const char *name = 0 ); + + virtual ~KNetworkConnector(); + + virtual void connectToServer( const QString &server ); + virtual ByteStream *stream() const; + virtual void done(); + + void setOptHostPort( const QString &host, Q_UINT16 port ); + + int errorCode(); + +private slots: + void slotConnected(); + void slotError( int ); + +private: + QString mHost; + Q_UINT16 mPort; + int mErrorCode; + + KNetworkByteStream *mByteStream; + +}; + +#endif + +// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off; diff --git a/kopete/protocols/yahoo/libkyahoo/yahootypes.h b/kopete/protocols/yahoo/libkyahoo/yahootypes.h new file mode 100644 index 00000000..e254bab7 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/yahootypes.h @@ -0,0 +1,182 @@ +/* + yahootypes.h - Kopete Yahoo Protocol definitions + + Copyright (c) 2004 Duncan Mac-Vicar Prett <[email protected]> + + Kopete (c) 2002-2005 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 YAHOOTYPESH +#define YAHOOTYPESH + +#include <qglobal.h> + +const int YAHOO_RAW_DEBUG = 14181; +const int YAHOO_GEN_DEBUG = 14180; + +namespace Yahoo +{ + enum Service + { + /* these are easier to see in hex */ + ServiceLogon = 1, + ServiceLogoff, + ServiceIsAway, + ServiceIsBack, + ServiceIdle, /* 5 (placemarker) */ + ServiceMessage, + ServiceIdAct, + ServiceIddeAct, + ServiceMailStat, + ServiceUserStat, /* 0xa */ + ServiceNewMail, + ServiceChatInvite, + ServiceCalendar, + ServiceNewPersonalMail, + ServiceNewContact, + ServiceAddIdent, /* 0x10 */ + ServiceAddIgnore, + ServicePing, + ServiceGotGroupRename, /* < 1, 36(old), 37(new) */ + ServiceSysMessage = 0x14, + ServicePassThrough2 = 0x16, + ServiceConfInvite = 0x18, + ServiceConfLogon, + ServiceConfDecline, + ServiceConfLogoff, + ServiceConfAddInvite, + ServiceConfMsg, + ServiceChatLogon, + ServiceChatLogoff, + ServiceChatMsg = 0x20, + ServiceGameLogon = 0x28, + ServiceGameLogoff, + ServiceGameMsg = 0x2a, + ServiceFileTransfer = 0x46, + ServiceVoiceChat = 0x4A, + ServiceNotify, + ServiceVerify = 76, + ServiceP2PFileXfer, + ServicePeerToPeer = 0x4F, /* Checks if P2P possible */ + ServiceWebcam, + ServiceAuthResp = 0x54, + ServiceList = 85, + ServiceAuth = 0x57, + ServiceAddBuddy = 0x83, + ServiceRemBuddy, + ServiceIgnoreContact, /* > 1, 7, 13 < 1, 66, 13, 0*/ + ServiceRejectContact, + ServiceGroupRename = 0x89, /* > 1, 65(new), 66(0), 67(old) */ + ServicePing7 = 0x8a, + ServiceChatOnline = 0x96, /* > 109(id), 1, 6(abcde) < 0,1*/ + ServiceChatGoto, + ServiceChatJoin, /* > 1 104-room 129-1600326591 62-2 */ + ServiceChatleave, + ServiceChatExit = 0x9b, + ServiceChatLogout = 0xa0, + ServiceChatPing, + ServiceComment = 0xa8, + ServiceStealthOffline = 0xb9, + ServiceStealthOnline = 0xba, + ServicePictureChecksum = 0xbd, + ServicePicture = 0xbe, + ServicePictureUpdate = 0xc1, + ServicePictureUpload = 0xc2, + ServiceVisibility = 0xc5, /* YMSG13, key 13: 2 = invisible, 1 = visible */ + ServiceStatus = 0xc6, /* YMSG13 */ + ServicePictureStatus = 0xc7, /* YMSG13, key 213: 0 = none, 1 = avatar, 2 = picture */ + ServiceContactDetails = 0xd3, /* YMSG13 */ + ServiceChatSession = 0xd4, + ServiceAuthorization = 0xd6, /* YMSG13 */ + ServiceFileTransfer7 = 0xdc, /* YMSG13 */ + ServiceFileTransfer7Info, /* YMSG13 */ + ServiceFileTransfer7Accept, /* YMSG13 */ + ServiceBuddyChangeGroup = 0xe7 /* YMSG13 */ + }; + + enum Status + { + StatusConnecting = -2, + StatusDisconnected = -1, + StatusAvailable = 0, + StatusBRB = 1, + StatusBusy, + StatusNotAtHome, + StatusNotAtDesk, + StatusNotInOffice, + StatusOnPhone, + StatusOnVacation, + StatusOutToLunch, + StatusSteppedOut, + StatusInvisible = 12, + StatusCustom = 99, + StatusIdle = 999, + StatusWebLogin = 0x5a55aa55, + StatusOffline = 0x5a55aa56, /* don't ask */ + StatusNotify = 0x16 + }; + + enum StatusType + { + StatusTypeAvailable = 0, + StatusTypeAway + }; + + enum LoginStatus { + LoginOk = 0, + LoginUname = 3, + LoginPasswd = 13, + LoginLock = 14, + LoginVerify = 29, // FIXME: Find the reason for this response + LoginDupl = 99, + LoginSock = -1 + }; + + enum StealthMode { + StealthOnline, + StealthOffline, + StealthPermOffline + }; + + enum StealthStatus { + StealthActive = 1, + StealthNotActive = 2, + StealthClear = 3 + }; + + enum Response { + ResponseAccept, + ResponseDecline + }; + + typedef Q_UINT8 BYTE; + typedef Q_UINT16 WORD; + typedef Q_UINT32 DWORD; +} + +#define yahoo_put16(buf, data) ( \ + (*(buf) = (unsigned char)((data)>>8)&0xff), \ + (*((buf)+1) = (unsigned char)(data)&0xff), \ + 2) +#define yahoo_get16(buf) ((((*(buf))&0xff)<<8) + ((*((buf)+1)) & 0xff)) +#define yahoo_put32(buf, data) ( \ + (*((buf)) = (unsigned char)((data)>>24)&0xff), \ + (*((buf)+1) = (unsigned char)((data)>>16)&0xff), \ + (*((buf)+2) = (unsigned char)((data)>>8)&0xff), \ + (*((buf)+3) = (unsigned char)(data)&0xff), \ + 4) +#define yahoo_get32(buf) ((((*(buf) )&0xff)<<24) + \ + (((*((buf)+1))&0xff)<<16) + \ + (((*((buf)+2))&0xff)<< 8) + \ + (((*((buf)+3))&0xff))) + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/ymsgprotocol.cpp b/kopete/protocols/yahoo/libkyahoo/ymsgprotocol.cpp new file mode 100644 index 00000000..79687073 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/ymsgprotocol.cpp @@ -0,0 +1,347 @@ +/* + Kopete Yahoo Protocol + + Copyright (c) 2004 Duncan Mac-Vicar Prett <[email protected]> + + Copyright (c) 2005 André Duffeck <[email protected]> + Kopete (c) 2002-2005 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include <stdlib.h> + +#include <qcstring.h> +#include <qdatastream.h> +#include <qmap.h> +#include <qobject.h> +#include <qstringlist.h> + +#include <kdebug.h> + +#include "ymsgprotocol.h" +#include "ymsgtransfer.h" +#include "yahootypes.h" + +using namespace Yahoo; + +YMSGProtocol::YMSGProtocol(QObject *parent, const char *name) + : InputProtocolBase(parent, name) +{ +} + +YMSGProtocol::~YMSGProtocol() +{ +} + +Transfer* YMSGProtocol::parse( const QByteArray & packet, uint& bytes ) +{ + /* + <------- 4B -------><------- 4B -------><---2B---> + +-------------------+-------------------+---------+ + | Y M S G | version | pkt_len | + +---------+---------+---------+---------+---------+ + | service | status | session_id | + +---------+-------------------+-------------------+ + | | + : D A T A : + / 0 - 65535* | + +-------------------------------------------------+ + */ + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << packet << endl; + + int pos = 0; + int len = 0; + + Yahoo::Status status = Yahoo::StatusAvailable; + Yahoo::Service service = Yahoo::ServiceAuth; + int statusnum = 0; + int sessionid = 0; + int servicenum; + int version1, version2; + + QMap<QString, QString> params; + + // Skip the YMSG header + pos += 4; + + // Skip the version + version1 = yahoo_get16(packet.data() + pos); + pos += 2; + version2 = yahoo_get16(packet.data() + pos); + pos += 2; + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " - parsed packet version " << version1 << " " << version2 << endl; + + len = yahoo_get16(packet.data() + pos); + pos += 2; + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " - parsed packet len " << len << endl; + + servicenum = yahoo_get16(packet.data() + pos); + pos += 2; + + switch (servicenum) + { + // TODO add remamining services + case (Yahoo::ServiceAuth) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceAuth " << servicenum << endl; + service = Yahoo::ServiceAuth; + break; + case (Yahoo::ServiceAuthResp) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceAuthResp " << servicenum << endl; + service = Yahoo::ServiceAuthResp; + break; + case (Yahoo::ServiceVerify) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceVerify " << servicenum << endl; + service = Yahoo::ServiceVerify; + break; + case (Yahoo::ServiceList) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceList " << servicenum << endl; + service = Yahoo::ServiceList; + break; + case (Yahoo::ServiceLogon) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceLogon " << servicenum << endl; + service = Yahoo::ServiceLogon; + break; + case (Yahoo::ServicePing) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServicePing " << servicenum << endl; + service = Yahoo::ServicePing; + break; + case (Yahoo::ServiceNewMail) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceNewMail " << servicenum << endl; + service = Yahoo::ServiceNewMail; + break; + case (Yahoo::ServiceLogoff) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceLogoff " << servicenum << endl; + service = Yahoo::ServiceLogoff; + break; + case (Yahoo::ServiceIsAway) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceIsAway " << servicenum << endl; + service = Yahoo::ServiceIsAway; + break; + case (Yahoo::ServiceIsBack) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceIsBack " << servicenum << endl; + service = Yahoo::ServiceIsBack; + break; + case (Yahoo::ServiceGameLogon) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceGameLogon " << servicenum << endl; + service = Yahoo::ServiceGameLogon; + break; + case (Yahoo::ServiceGameLogoff) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceGameLogoff " << servicenum << endl; + service = Yahoo::ServiceGameLogoff; + break; + case (Yahoo::ServiceIdAct) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceIdAct " << servicenum << endl; + service = Yahoo::ServiceIdAct; + break; + case (Yahoo::ServiceIddeAct) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceIddeAct " << servicenum << endl; + service = Yahoo::ServiceIddeAct; + break; + case (Yahoo::ServiceStatus) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceStatus " << servicenum << endl; + service = Yahoo::ServiceStatus; + break; + case (Yahoo::ServiceMessage) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceMessage " << servicenum << endl; + service = Yahoo::ServiceMessage; + break; + case (Yahoo::ServiceNotify) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceNotify " << servicenum << endl; + service = Yahoo::ServiceNotify; + break; + case (Yahoo::ServiceAddBuddy) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceAddBuddy " << servicenum << endl; + service = Yahoo::ServiceAddBuddy; + break; + case (Yahoo::ServicePictureChecksum) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServicePictureChecksum " << servicenum << endl; + service = Yahoo::ServicePictureChecksum; + break; + case (Yahoo::ServicePictureStatus) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServicePictureStatus " << servicenum << endl; + service = Yahoo::ServicePictureStatus; + break; + case (Yahoo::ServicePicture) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServicePicture " << servicenum << endl; + service = Yahoo::ServicePicture; + break; + case (Yahoo::ServiceStealthOnline) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceStealthOnline " << servicenum << endl; + service = Yahoo::ServiceStealthOnline; + break; + case (Yahoo::ServiceStealthOffline) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceStealthOffline " << servicenum << endl; + service = Yahoo::ServiceStealthOffline; + break; + case (Yahoo::ServicePictureUpload) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServicePictureUpload " << servicenum << endl; + service = Yahoo::ServicePictureUpload; + break; + case (Yahoo::ServiceWebcam) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceWebcam " << servicenum << endl; + service = Yahoo::ServiceWebcam; + break; + case (Yahoo::ServiceConfInvite) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceConfInvite " << servicenum << endl; + service = Yahoo::ServiceConfInvite; + break; + case (Yahoo::ServiceConfLogon) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceConfLogon " << servicenum << endl; + service = Yahoo::ServiceConfLogon; + break; + case (Yahoo::ServiceConfDecline) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceConfDecline " << servicenum << endl; + service = Yahoo::ServiceConfDecline; + break; + case (Yahoo::ServiceConfLogoff) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceConfLogoff " << servicenum << endl; + service = Yahoo::ServiceConfLogoff; + break; + case (Yahoo::ServiceConfAddInvite) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceConfAddInvite " << servicenum << endl; + service = Yahoo::ServiceConfAddInvite; + break; + case (Yahoo::ServiceConfMsg) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceConfMsg " << servicenum << endl; + service = Yahoo::ServiceConfMsg; + break; + case (Yahoo::ServiceAuthorization) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceAuthorization " << servicenum << endl; + service = Yahoo::ServiceAuthorization; + break; + case (Yahoo::ServiceContactDetails) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceContactDetails " << servicenum << endl; + service = Yahoo::ServiceContactDetails; + break; + case (Yahoo::ServiceFileTransfer) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceFileTransfer " << servicenum << endl; + service = Yahoo::ServiceFileTransfer; + break; + case (Yahoo::ServiceFileTransfer7) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceFileTransfer7 " << servicenum << endl; + service = Yahoo::ServiceFileTransfer7; + break; + case (Yahoo::ServiceFileTransfer7Info) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServiceFileTransfer7Info " << servicenum << endl; + service = Yahoo::ServiceFileTransfer7Info; + break; + case (Yahoo::ServicePeerToPeer) : + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means ServicePeerToPeer " << servicenum << endl; + service = Yahoo::ServicePeerToPeer; + break; + /* + ServiceIdle, // 5 (placemarker) + ServiceMailStat, + ServiceUserStat, // 0xa + ServiceChatInvite, + ServiceCalendar, + ServiceNewPersonalMail, + ServiceNewContact, + ServiceAddIdent, // 0x10 + ServiceAddIgnore, + ServiceGotGroupRename, // < 1, 36(old), 37(new) + ServiceSysMessage = 0x14, + ServicePassThrough2 = 0x16, + ServiceChatLogon, + ServiceChatLogoff, + ServiceChatMsg = 0x20, + ServiceGameMsg = 0x2a, + ServiceFileTransfer = 0x46, + ServiceVoiceChat = 0x4A, + ServiceVerify = 76, + ServiceP2PFileXfer, + ServiceRemBuddy, + ServiceIgnoreContact, // > 1, 7, 13 < 1, 66, 13, 0 + ServiceRejectContact, + ServiceGroupRename = 0x89, // > 1, 65(new), 66(0), 67(old) + ServiceChatOnline = 0x96, // > 109(id), 1, 6(abcde) < 0,1 + ServiceChatGoto, + ServiceChatJoin, // > 1 104-room 129-1600326591 62-2 + ServiceChatleave, + ServiceChatExit = 0x9b, + ServiceChatLogout = 0xa0, + ServiceChatPing, + ServiceComment = 0xa8 + ServicePictureUpdate = 0xc1, + ServiceVisibility = 0xc5, // YMSG13, key 13: 2 = invisible, 1 = visible + ServiceStatus = 0xc6, // YMSG13 + */ + + default: + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed packet service - This means an unknown service " << servicenum << endl; + break; + } + + statusnum = yahoo_get32(packet.data() + pos); + pos += 4; + + switch (statusnum) + { + // TODO add remaining status + case (Yahoo::StatusAvailable) : + status = Yahoo::StatusAvailable; + break; + case (Yahoo::StatusBRB) : + status = Yahoo::StatusBRB; + break; + case (Yahoo::StatusDisconnected) : + status = Yahoo::StatusDisconnected; + break; + /*StatusBusy + StatusNotAtHome + StatusNotAtDesk + StatusNotInOffice + StatusOnPhone + StatusOnVacation + StatusOutToLunch + StatusSteppedOut + StatusInvisible + StatusCustom + StatusIdle + StatusOffline + StatusNotify*/ + default: + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " - unknown status " << statusnum << endl; + break; + } + + sessionid = yahoo_get32(packet.data() + pos); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Parsed session id: " << (void *)sessionid << endl; + pos += 4; + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Setting incoming transfer basic information." << endl; + YMSGTransfer *t = new YMSGTransfer(); + t->setService(service); + t->setId(sessionid); + t->setStatus(status); + + QString d = QString::fromAscii( packet.data() + pos, packet.size() - pos ); + QStringList list; + list = QStringList::split( "\xc0\x80", d ); + for( uint i = 0; i+1 < list.size() && pos+1 < len+20; i += 2 ) { + QString key = list[i]; + QString value = QString::fromUtf8( list[i+1].ascii() ); + pos += key.utf8().length() + value.utf8().length() + 4; + t->setParam( QString(key).toInt(), value.utf8() ); + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << "Key: " << key << " Value: " << value << endl; + } + + while( (uint)pos < packet.size() && packet.data()[pos] == '\x00' ) + pos++; + + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Returning transfer" << endl; + // tell them we have parsed offset bytes + + bytes = pos; + return t; +} + +#include "ymsgprotocol.moc" diff --git a/kopete/protocols/yahoo/libkyahoo/ymsgprotocol.h b/kopete/protocols/yahoo/libkyahoo/ymsgprotocol.h new file mode 100644 index 00000000..97de7477 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/ymsgprotocol.h @@ -0,0 +1,44 @@ +/* + Kopete Yahoo Protocol + + Copyright (c) 2004 Duncan Mac-Vicar Prett <[email protected]> + + Copyright (c) 2005 André Duffeck <[email protected]> + Kopete (c) 2002-2005 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 YAHOO_YMSGPROTOCOL_H +#define YAHOO_YMSGPROTOCOL_H + +#include "inputprotocolbase.h" + + +class YMSGProtocol : public InputProtocolBase +{ +Q_OBJECT +public: + + + YMSGProtocol( QObject *parent = 0, const char *name = 0 ); + ~YMSGProtocol(); + + /** + * Attempt to parse the supplied data into an @ref YMSGTransfer object. + * The exact state of the parse attempt can be read using @ref state. + * @param rawData The unparsed data. + * @param bytes An integer used to return the number of bytes read. + * @return A pointer to an EventTransfer object if successfull, otherwise 0. The caller is responsible for deleting this object. + */ + Transfer * parse( const QByteArray &, uint & bytes ); +}; + +#endif diff --git a/kopete/protocols/yahoo/libkyahoo/ymsgtransfer.cpp b/kopete/protocols/yahoo/libkyahoo/ymsgtransfer.cpp new file mode 100644 index 00000000..f47a07d1 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/ymsgtransfer.cpp @@ -0,0 +1,239 @@ +/* + Kopete Yahoo Protocol + Handles logging into to the Yahoo service + + Copyright (c) 2004 Duncan Mac-Vicar P. <[email protected]> + + Copyright (c) 2005 André Duffeck <[email protected]> + + Kopete (c) 2002-2005 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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. * + * * + ************************************************************************* +*/ + +#include <string> + +#include "ymsgtransfer.h" +#include "yahootypes.h" +#include "kdebug.h" +#include <qdatastream.h> +#include <qmap.h> +#include <qstring.h> +#include <qstringlist.h> + + +using namespace Yahoo; + +class YMSGTransferPrivate +{ +public: + int yflag; + int version; + int packetLength; + Yahoo::Service service; + Yahoo::Status status; + unsigned int id; + ParamList data; + bool valid; +}; + +YMSGTransfer::YMSGTransfer() +{ + d = new YMSGTransferPrivate; + d->valid = true; + d->id = 0; + d-> status = Yahoo::StatusAvailable; +} + +YMSGTransfer::YMSGTransfer(Yahoo::Service service) +{ + d = new YMSGTransferPrivate; + d->valid = true; + d->service = service; + d->id = 0; + d->status = Yahoo::StatusAvailable; +} + +YMSGTransfer::YMSGTransfer(Yahoo::Service service, Yahoo::Status status) +{ + d = new YMSGTransferPrivate; + d->valid = true; + d->service = service; + d->id = 0; + d->status = status; +} + +YMSGTransfer::~YMSGTransfer() +{ + delete d; +} + +Transfer::TransferType YMSGTransfer::type() +{ + return Transfer::YMSGTransfer; +} + +bool YMSGTransfer::isValid() +{ + return d->valid; +} + +Yahoo::Service YMSGTransfer::service() +{ + return d->service; +} + +void YMSGTransfer::setService(Yahoo::Service service) +{ + d->service = service; +} + +Yahoo::Status YMSGTransfer::status() +{ + return d->status; +} + +void YMSGTransfer::setStatus(Yahoo::Status status) +{ + d->status = status; +} + +unsigned int YMSGTransfer::id() +{ + return d->id; +} + +void YMSGTransfer::setId(unsigned int id) +{ + d->id = id; +} + +ParamList YMSGTransfer::paramList() +{ + return d->data; +} + +int YMSGTransfer::paramCount( int index ) +{ + int cnt = 0; + for (ParamList::ConstIterator it = d->data.begin(); it != d->data.end(); ++it) + { + if( (*it).first == index ) + cnt++; + } + return cnt; +} + + +QCString YMSGTransfer::nthParam( int index, int occurence ) +{ + int cnt = 0; + for (ParamList::ConstIterator it = d->data.begin(); it != d->data.end(); ++it) + { + if( (*it).first == index && cnt++ == occurence) + return (*it).second; + } + return QCString(); +} + +QCString YMSGTransfer::nthParamSeparated( int index, int occurence, int separator ) +{ + + int cnt = -1; + for (ParamList::ConstIterator it = d->data.begin(); it != d->data.end(); ++it) + { + if( (*it).first == separator ) + cnt++; + if( (*it).first == index && cnt == occurence) + return (*it).second; + } + return QCString(); +} + +QCString YMSGTransfer::firstParam( int index ) +{ + for (ParamList::ConstIterator it = d->data.begin(); it != d->data.end(); ++it) + { + if( (*it).first == index ) + return (*it).second; + } + return QCString(); +} + +void YMSGTransfer::setParam(int index, const QCString &data) +{ + d->data.append( Param( index, data ) ); +} + +void YMSGTransfer::setParam( int index, int data ) +{ + d->data.append( Param( index, QString::number( data ).local8Bit() ) ); +} + +int YMSGTransfer::length() +{ + int len = 0; + for (ParamList::ConstIterator it = d->data.begin(); it != d->data.end(); ++it) + { + len += QString::number( (*it).first ).length(); + len += 2; + len += (*it).second.length(); + len += 2; + } + return len; +} + + +QByteArray YMSGTransfer::serialize() +{ + /* + <------- 4B -------><------- 4B -------><---2B---> + +-------------------+-------------------+---------+ + | Y M S G | version | pkt_len | + +---------+---------+---------+---------+---------+ + | service | status | session_id | + +---------+-------------------+-------------------+ + | | + : D A T A : + / 0 - 65535* | + +-------------------------------------------------+ + */ + + int pos = 0; + QStringList::ConstIterator listIt = 0; + QByteArray buffer; + QDataStream stream( buffer, IO_WriteOnly ); + + stream << (Q_INT8)'Y' << (Q_INT8)'M' << (Q_INT8)'S' << (Q_INT8)'G'; + if( d->service == Yahoo::ServicePictureUpload ) + stream << (Q_INT16)0x0e00; + else + stream << (Q_INT16)0x000e; + stream << (Q_INT16)0x0000; + if( d->service == Yahoo::ServicePictureUpload || + d->service == Yahoo::ServiceFileTransfer ) + stream << (Q_INT16)(length()+4); + else + stream << (Q_INT16)length(); + stream << (Q_INT16)d->service; + stream << (Q_INT32)d->status; + stream << (Q_INT32)d->id; + for (ParamList::ConstIterator it = d->data.begin(); it != d->data.end(); ++it) + { + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " Serializing key " << (*it).first << " value " << (*it).second << endl; + stream.writeRawBytes ( QString::number( (*it).first ).local8Bit(), QString::number( (*it).first ).length() ); + stream << (Q_INT8)0xc0 << (Q_INT8)0x80; + stream.writeRawBytes( (*it).second, (*it).second.length() ); + stream << (Q_INT8)0xc0 << (Q_INT8)0x80; + } + kdDebug(YAHOO_RAW_DEBUG) << k_funcinfo << " pos=" << pos << " (packet size)" << buffer << endl; + return buffer; +} + diff --git a/kopete/protocols/yahoo/libkyahoo/ymsgtransfer.h b/kopete/protocols/yahoo/libkyahoo/ymsgtransfer.h new file mode 100644 index 00000000..79655766 --- /dev/null +++ b/kopete/protocols/yahoo/libkyahoo/ymsgtransfer.h @@ -0,0 +1,76 @@ +/* + Kopete Yahoo Protocol + Handles logging into to the Yahoo service + + Copyright (c) 2004 Duncan Mac-Vicar P. <[email protected]> + + Copyright (c) 2005 André Duffeck <[email protected]> + + Kopete (c) 2002-2005 by the Kopete developers <[email protected]> + + ************************************************************************* + * * + * 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 YMSG_TRANSFER_H +#define YMSG_TRANSFER_H + +#include "transfer.h" + +#include "yahootypes.h" +#include <qcstring.h> +#include <qpair.h> +#include <qvaluelist.h> + +class YMSGTransferPrivate; +class QString; + +typedef QPair< int, QCString > Param; +typedef QValueList< Param > ParamList; + +/** +@author Duncan Mac-Vicar Prett +*/ +class YMSGTransfer : public Transfer +{ +public: + YMSGTransfer(Yahoo::Service service); + YMSGTransfer(Yahoo::Service service, Yahoo::Status status); + YMSGTransfer(); + ~YMSGTransfer(); + + + TransferType type(); + + //! Get the validity of the transfer object + bool isValid(); + Yahoo::Service service(); + void setService(Yahoo::Service service); + Yahoo::Status status(); + void setStatus(Yahoo::Status status); + unsigned int id(); + void setId(unsigned int id); + + ParamList paramList(); + QCString firstParam( int index ); + QCString nthParam( int index, int occurence ); + QCString nthParamSeparated( int index, int occurence, int separator ); + int paramCount( int index ); + + + void setParam(int index, const QCString &data); + void setParam(int index, int data); + QByteArray serialize(); + + int length(); +private: + YMSGTransferPrivate* d; +}; + +#endif |