[pkg-kde-commits] rev 2874 - in trunk/packages/kdenetwork/debian: .
patches
Christopher Martin
chrsmrtn at costa.debian.org
Sat Jan 14 16:25:48 UTC 2006
Author: chrsmrtn
Date: 2006-01-14 16:25:44 +0000 (Sat, 14 Jan 2006)
New Revision: 2874
Added:
trunk/packages/kdenetwork/debian/patches/12_kopete_meanwhile.diff
Modified:
trunk/packages/kdenetwork/debian/changelog
Log:
Here's the patch for meanwhile; I can revert if we don't go this route.
Modified: trunk/packages/kdenetwork/debian/changelog
===================================================================
--- trunk/packages/kdenetwork/debian/changelog 2006-01-14 16:13:10 UTC (rev 2873)
+++ trunk/packages/kdenetwork/debian/changelog 2006-01-14 16:25:44 UTC (rev 2874)
@@ -7,9 +7,15 @@
+++ Changes by Christopher Martin:
* Change kopete's Suggests: gpg to gnupg. (Closes: #347969)
-
- -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>
+ * Take a diff of the meanwhile plugin from the next Kopete version
+ development branch, and apply it to KDE 3.5. This includes a number of
+ fixes, and allows us to build against a more up-to-date libmeanwhile.
+
+ !!! TODO: Bump libmeanwhile build-deps / Update buildprep !!!
+
+ -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org> Date
+
kdenetwork (4:3.5.0-3) unstable; urgency=low
+++ Changes by Christopher Martin:
Added: trunk/packages/kdenetwork/debian/patches/12_kopete_meanwhile.diff
===================================================================
--- trunk/packages/kdenetwork/debian/patches/12_kopete_meanwhile.diff 2006-01-14 16:13:10 UTC (rev 2873)
+++ trunk/packages/kdenetwork/debian/patches/12_kopete_meanwhile.diff 2006-01-14 16:25:44 UTC (rev 2874)
@@ -0,0 +1,3482 @@
+--- kde.orig/kopete/protocols/meanwhile/kopete_meanwhile.desktop
++++ kde.patched/kopete/protocols/meanwhile/kopete_meanwhile.desktop
+@@ -6,8 +6,8 @@
+ ServiceTypes=Kopete/Protocol
+ X-KDE-Library=kopete_meanwhile
+ X-Kopete-Messaging-Protocol=messaging/meanwhile
+-X-KDE-PluginInfo-Author=Sivaram Gottimukkala
+-X-KDE-PluginInfo-Email=sivaram at somewhere.net
++X-KDE-PluginInfo-Author=Jeremy Kerr
++X-KDE-PluginInfo-Email=jk at ozlabs.org
+ X-KDE-PluginInfo-Name=kopete_meanwhile
+ X-KDE-PluginInfo-Version=0.0.1
+ X-KDE-PluginInfo-Website=http://kopete.kde.org
+@@ -20,38 +20,4 @@
+ Name[mk]=Во меѓувреме
+ Name[nb]=Imens
+ Name[ta]=இடைப்பட்ட பொழுதில்
+-Comment=Meanwhile protocol plugin
+-Comment[bg]=Протокол за връзка с Meanwhile
+-Comment[ca]=Connector de protocol Meanwhile
+-Comment[cs]=Modul protokolu Meanwhile
+-Comment[da]=Meanwhile-protokol-plugin
+-Comment[de]=Meanwhile Protokoll-Modul
+-Comment[el]=Πρόσθετο του πρωτοκόλλου Meanwhile
+-Comment[es]=Plugin del protocolo de Meanwhile
+-Comment[et]=Meanwhile protokolli plugin
+-Comment[eu]=Meanwhile protokolo plugin-a
+-Comment[fi]=Meanwhile-yhteyskäytäntöliitännäinen
+-Comment[fr]=Module du protocole Meanwhile
+-Comment[gl]=Plugin para o protocolo Meanwhile
+-Comment[he]=תוסף פרוטוקול של Meanwhile
+-Comment[hu]=Meanwhile modul
+-Comment[is]=Á meðan samskiptureglu íforrit
+-Comment[it]=Plugin del protocollo di Meanwhile
+-Comment[lt]=Meanwhile protokolo įskiepis
+-Comment[nb]=Programtillegg for Imens-protokoll
+-Comment[nl]=Procotol voor Meanwhile
+-Comment[nn]=Programtillegg for Meanwhile-protokollen
+-Comment[pl]=Wtyczka protokołu Meanwhile
+-Comment[pt]='Plugin' de protocolo Meanwhile
+-Comment[pt_BR]=Plugin para o protocolo Meanwhile
+-Comment[ro]=Modul de protocol Meanwhile
+-Comment[ru]=Модуль протокола Meanwhile
+-Comment[sl]=Vstavek za protokol Meanwhile
+-Comment[sr]=Прикључак за протокол Meanwhile
+-Comment[sr at Latn]=Priključak za protokol Meanwhile
+-Comment[sv]=Meanwhile-protokollinsticksprogram
+-Comment[ta]=இடைப்பட்ட நெறிமுறை சொருகுப்பொருள்
+-Comment[tr]=Meanwhile iletişim kuralı eklentisi
+-Comment[uk]=Втулок протоколу для Meanwhile
+-Comment[uz]=Meanwhile учун протокол
+-Comment[zh_CN]=Meanwhile 协议插件
++Comment=Meanwhile (Lotus Sametime) Protocol
+--- kde.orig/kopete/protocols/meanwhile/Makefile.am
++++ kde.patched/kopete/protocols/meanwhile/Makefile.am
+@@ -5,7 +5,6 @@
+ -I$(srcdir)/ui \
+ -I./ui \
+ $(all_includes) \
+- $(GLIB_CFLAGS) \
+ $(MEANWHILE_CFLAGS)
+
+ noinst_HEADERS = \
+@@ -14,7 +13,7 @@
+ meanwhileeditaccountwidget.h \
+ meanwhileaccount.h \
+ meanwhilecontact.h \
+- meanwhilelibrary.h \
++ meanwhilesession.h \
+ meanwhileplugin.h
+
+ kde_module_LTLIBRARIES = kopete_meanwhile.la
+@@ -25,14 +24,14 @@
+ meanwhileeditaccountwidget.cpp \
+ meanwhileaccount.cpp \
+ meanwhilecontact.cpp \
+- meanwhilelibrary.cpp \
++ meanwhilesession.cpp \
+ meanwhileplugin.cpp
+
+ kopete_meanwhile_la_LDFLAGS = -no-undefined -module \
+ $(KDE_PLUGIN) $(all_libraries)
+
+ kopete_meanwhile_la_LIBADD = $(top_builddir)/kopete/libkopete/libkopete.la \
+- ui/libkopetemeanwhileui.la $(GLIB_LIBS) $(MEANWHILE_LIBS)
++ ui/libkopetemeanwhileui.la $(MEANWHILE_LIBS)
+
+ service_DATA = kopete_meanwhile.desktop
+ servicedir= $(kde_servicesdir)
+--- kde.orig/kopete/protocols/meanwhile/meanwhileaccount.cpp
++++ kde.patched/kopete/protocols/meanwhile/meanwhileaccount.cpp
+@@ -20,8 +20,9 @@
+ #include "meanwhileplugin.h"
+ #include "meanwhileaccount.h"
+ #include "meanwhilecontact.h"
+-#include "meanwhilelibrary.h"
++#include "meanwhilesession.h"
+ #include "kopetechatsession.h"
++#include "kopetecontactlist.h"
+ #include "kopetepassword.h"
+
+ #include <kaction.h>
+@@ -40,27 +41,18 @@
+ : Kopete::PasswordedAccount(parent, accountID, 0, name)
+ {
+ HERE;
+- //signal(SIGSEGV,SIG_DFL);
+- setMyself(new MeanwhileContact(accountId(), accountId(), this, 0L));
+- myself()->setOnlineStatus(MeanwhileProtocol::protocol()->meanwhileOffline);
+- m_library = 0L;
++ m_meanwhileId = accountID;
++ m_session = 0L;
++ setMyself(new MeanwhileContact(m_meanwhileId, m_meanwhileId, this,
++ Kopete::ContactList::self()->myself()));
++ setOnlineStatus(parent->statusOffline);
+ infoPlugin = new MeanwhilePlugin();
+ }
+
+-void MeanwhileAccount::initLibrary()
+-{
+-}
+-
+-MeanwhileLibrary *MeanwhileAccount::library()
+-{
+- return m_library;
+-}
+-
+ MeanwhileAccount::~MeanwhileAccount()
+ {
+- meanwhileGoOffline();
+- if (m_library)
+- delete m_library;
++ if (m_session)
++ delete m_session;
+ }
+
+ void MeanwhileAccount::setPlugin(MeanwhilePlugin *plugin)
+@@ -73,15 +65,15 @@
+ const QString & contactId ,
+ Kopete::MetaContact * parentContact)
+ {
+- MeanwhileContact* newContact =
+- new MeanwhileContact(contactId,
+- parentContact->displayName(),
+- this,
+- parentContact);
+- if ((newContact != 0L) && (m_library != 0L)
++ MeanwhileContact* newContact = new MeanwhileContact(contactId,
++ parentContact->displayName(), this, parentContact);
++
++ MeanwhileProtocol *p = static_cast<MeanwhileProtocol *>(protocol());
++
++ if ((newContact != 0L) && (m_session != 0L)
+ && (myself()->onlineStatus() !=
+- MeanwhileProtocol::protocol()->meanwhileOffline))
+- m_library->addContact(newContact);
++ p->statusOffline))
++ m_session->addContact(newContact);
+
+ return newContact != 0L;
+ }
+@@ -93,25 +85,33 @@
+ return;
+ }
+
+- if (m_library == 0L) {
+- m_library = new MeanwhileLibrary(this);
+- if (!m_library) {
+- mwDebug() << "library creation failed" << endl;
++ if (m_session == 0L) {
++ m_session = new MeanwhileSession(this);
++ if (m_session == 0L) {
++ mwDebug() << "session creation failed" << endl;
+ return;
+ }
+
+- QObject::connect(m_library, SIGNAL(loginDone()),
+- this, SLOT(slotLoginDone()));
+- QObject::connect(m_library, SIGNAL(connectionLost()),
+- this, SLOT(slotConnectionLost()));
+- QObject::connect(m_library,
++ QObject::connect(m_session,
++ SIGNAL(sessionStateChange(Kopete::OnlineStatus)),
++ this, SLOT(slotSessionStateChange(Kopete::OnlineStatus)));
++ QObject::connect(m_session,
+ SIGNAL(serverNotification(const QString &)),
+ this, SLOT(slotServerNotification(const QString&)));
++
+ }
+-
+- if (!m_library->isConnected()) {
+- m_library->login();
++
++ if (m_session == 0L) {
++ mwDebug() << "No memory for session" << endl;
++ return;
+ }
++
++ if (!m_session->isConnected() && !m_session->isConnecting())
++ m_session->connect(configGroup()->readEntry("Server"),
++ configGroup()->readNumEntry("Port"),
++ m_meanwhileId, password);
++
++ m_session->setStatus(initialStatus());
+ }
+
+ void MeanwhileAccount::disconnect()
+@@ -121,177 +121,124 @@
+
+ void MeanwhileAccount::disconnect(Kopete::Account::DisconnectReason reason)
+ {
+- if (m_library != 0L && m_library->isConnected())
+- m_library->logoff();
+-
+- if (m_library != 0L) {
+- delete m_library;
+- m_library = 0L;
+- }
++ if (m_session == 0L)
++ return;
+
+- myself()->setOnlineStatus(MeanwhileProtocol::protocol()->meanwhileOffline);
+- setAllContactsStatus(MeanwhileProtocol::protocol()->meanwhileOffline);
++ MeanwhileProtocol *p = static_cast<MeanwhileProtocol *>(protocol());
++ setAllContactsStatus(p->statusOffline);
+ disconnected(reason);
+ emit isConnectedChanged();
+-}
+
+-void MeanwhileAccount::setAway(bool away, const QString &reason)
+-{
+- if (away)
+- meanwhileGoAway(reason);
+- else
+- meanwhileGoOnline();
++ delete m_session;
++ m_session = 0L;
+ }
+
+ KActionMenu * MeanwhileAccount::actionMenu()
+ {
+- KActionMenu * theMenu =
+- new KActionMenu(accountId(),
+- myself()->onlineStatus().iconFor(this),
+- this);
+- theMenu->popupMenu()->insertTitle(
+- myself()->icon(),
+- i18n("Meanwhile (%1)").arg(accountId()));
+- theMenu->insert(
+- new KAction( i18n( "Go Online" ),
+- MeanwhileProtocol::protocol()->meanwhileOnline.iconFor(this),
+- 0, this, SLOT(meanwhileGoOnline()), this, "meanwhileGoOnline"));
+-
+- theMenu->insert(
+- new KAction( i18n( "Go Offline" ),
+- MeanwhileProtocol::protocol()->meanwhileOffline.iconFor(this),
+- 0, this, SLOT(meanwhileGoOffline()), this, "meanwhileGoOffline"));
+-
+- theMenu->insert(
+- new KAction( i18n( "Go Away" ),
+- MeanwhileProtocol::protocol()->meanwhileAway.iconFor(this),
+- 0, this, SLOT(meanwhileGoAway()), this, "meanwhileGoAway"));
+-
+- theMenu->insert(
+- new KAction( i18n( "Mark as Busy" ),
+- MeanwhileProtocol::protocol()->meanwhileBusy.iconFor(this),
+- 0, this, SLOT(meanwhileGoDND()), this, "meanwhileGoDND"));
+-
+- theMenu->popupMenu()->insertSeparator();
+-
+- theMenu->insert(
+- new KAction( i18n("&Change Status Message"), QString::null,
+- 0, this, SLOT(meanwhileChangeStatus()), this,
+- "meanwhileChangeStatus"));
++ KActionMenu *menu = Kopete::Account::actionMenu();
+
+- infoPlugin->addCustomMenus(theMenu);
++ menu->popupMenu()->insertSeparator();
+
+- return theMenu;
++#if 0
++ menu->insert(new KAction(i18n("&Change Status Message"), QString::null, 0,
++ this, SLOT(meanwhileChangeStatus()), this,
++ "meanwhileChangeStatus"));
++ //infoPlugin->addCustomMenus(theMenu);
++#endif
++ return menu;
+ }
+
+-void MeanwhileAccount::meanwhileGoOnline()
++QString MeanwhileAccount::getServerName()
+ {
+- HERE;
+- if (m_library != 0L && m_library->isConnected())
+- m_library->setState(MeanwhileProtocol::protocol()->meanwhileOnline);
+- else
+- connect(MeanwhileProtocol::protocol()->meanwhileOnline);
++ return configGroup()->readEntry("Server");
+ }
+
+-void MeanwhileAccount::meanwhileGoOffline()
++int MeanwhileAccount::getServerPort()
+ {
+- disconnect();
++ return configGroup()->readNumEntry("Port");
+ }
+
+-void MeanwhileAccount::meanwhileGoAway()
++void MeanwhileAccount::setServerName(const QString &server)
+ {
+- meanwhileGoAway(Kopete::Away::getInstance()->message());
++ configGroup()->writeEntry("Server", server);
+ }
+
+-void MeanwhileAccount::meanwhileGoAway(const QString &statusmsg)
++void MeanwhileAccount::setServerPort(int port)
+ {
+- if ((m_library != 0L) && (myself()->onlineStatus() !=
+- MeanwhileProtocol::protocol()->meanwhileOffline))
+- m_library->setState(MeanwhileProtocol::protocol()->meanwhileAway,
+- statusmsg);
++ configGroup()->writeEntry("Port", port);
+ }
+
+-void MeanwhileAccount::meanwhileGoDND()
++void MeanwhileAccount::slotServerNotification(const QString &mesg)
+ {
+- if ((m_library != 0L) && (myself()->onlineStatus() !=
+- MeanwhileProtocol::protocol()->meanwhileOffline))
+- m_library->setState(MeanwhileProtocol::protocol()->meanwhileBusy);
++ KMessageBox::queuedMessageBox(0, KMessageBox::Error , mesg,
++ i18n("Meanwhile Plugin: Message from server"), KMessageBox::Notify);
+ }
+
+-void MeanwhileAccount::slotLoginDone()
++QString MeanwhileAccount::meanwhileId() const
+ {
+- myself()->setOnlineStatus(MeanwhileProtocol::protocol()->meanwhileOnline);
+- statusMesg = QString("I am active");
+- m_library->setState(MeanwhileProtocol::protocol()->meanwhileOnline);
+- m_library->addContacts(contacts());
+- emit isConnectedChanged();
++ return m_meanwhileId;
+ }
+
+-QString MeanwhileAccount::serverName()
++void MeanwhileAccount::setAway(bool away, const QString &reason)
+ {
+- return configGroup()->readEntry("Server");
++ MeanwhileProtocol *p = static_cast<MeanwhileProtocol *>(protocol());
++ setOnlineStatus(away ? p->statusIdle : p->statusOnline, reason);
+ }
+
+-int MeanwhileAccount::serverPort()
++void MeanwhileAccount::setOnlineStatus(const Kopete::OnlineStatus &status,
++ const QString &reason)
+ {
+- return configGroup()->readNumEntry("Port");
+-}
++ HERE;
++ Kopete::OnlineStatus oldstatus = myself()->onlineStatus();
+
+-void MeanwhileAccount::setServerName(const QString &server)
+-{
+- configGroup()->writeEntry("Server", server);
+-}
++ mwDebug() << "From: " << oldstatus.description() << "(" <<
++ oldstatus.internalStatus() << "):" << oldstatus.isDefinitelyOnline()
++ << endl;
++ mwDebug() << "To: " << status.description() << "(" <<
++ status.internalStatus() << "):" << status.isDefinitelyOnline() << endl;
+
+-void MeanwhileAccount::setServerPort(int port)
+-{
+- configGroup()->writeEntry("Port", port);
+-}
++ if (oldstatus == status)
++ return;
+
+-void MeanwhileAccount::meanwhileChangeStatus()
+-{
+- bool ok;
+- statusMesg = KInputDialog::getText(
+- i18n("Change Status Message - Meanwhile Plugin"),
+- i18n("Enter the message to show under your status:"),
+- statusMesg, &ok);
++ if (!oldstatus.isDefinitelyOnline() && status.isDefinitelyOnline()) {
++ connect();
+
+- if (ok && m_library != 0L)
+- m_library->setStatusMesg(statusMesg);
+-}
++ } else if (oldstatus.isDefinitelyOnline() && !status.isDefinitelyOnline()) {
++ disconnect(Kopete::Account::Manual);
+
+-void MeanwhileAccount::slotServerNotification(const QString &mesg)
+-{
+- KMessageBox::queuedMessageBox(
+- 0, KMessageBox::Error ,
+- mesg,
+- i18n( "Meanwhile Plugin: Message from server" ),
+- KMessageBox::Notify );
++ } else if (m_session)
++ /* todo: check session state? */
++ m_session->setStatus(status, reason);
++
++ else
++ mwDebug() << "Trying to set status, but no session exists" << endl;
++
++ /* we should set this on the callback below */
++ //myself()->setOnlineStatus(status);
+ }
+
+-void MeanwhileAccount::slotConnectionLost()
++void MeanwhileAccount::syncContactsToServer()
+ {
+- delete m_library;
+- m_library = 0L;
+- meanwhileGoOffline();
++ if (m_session != 0L)
++ m_session->syncContactsToServer();
+ }
+
+-void MeanwhileAccount::setOnlineStatus(const Kopete::OnlineStatus & status,
+- const QString &reason)
++void MeanwhileAccount::slotSessionStateChange(Kopete::OnlineStatus status)
+ {
+- Kopete::OnlineStatus mystatus = myself()->onlineStatus().status();
++ HERE;
++ Kopete::OnlineStatus oldstatus = myself()->onlineStatus();
++ myself()->setOnlineStatus(status);
+
+- if (mystatus == Kopete::OnlineStatus::Offline
+- && status.status() == Kopete::OnlineStatus::Online )
+- connect(status);
+-
+- else if (mystatus != Kopete::OnlineStatus::Offline
+- && status.status() == Kopete::OnlineStatus::Offline )
+- disconnect();
+-
+- else if (mystatus != Kopete::OnlineStatus::Offline
+- && status.status() == Kopete::OnlineStatus::Away )
+- setAway(true, reason);
++ if (status.isDefinitelyOnline() != oldstatus.isDefinitelyOnline()) {
++ if (status.isDefinitelyOnline())
++ m_session->addContacts(contacts());
++ emit isConnectedChanged();
++ }
+ }
+
++MeanwhileSession *MeanwhileAccount::session()
++{
++ return m_session;
++}
+
+ #include "meanwhileaccount.moc"
+--- kde.orig/kopete/protocols/meanwhile/meanwhileaccount.h
++++ kde.patched/kopete/protocols/meanwhile/meanwhileaccount.h
+@@ -22,15 +22,23 @@
+ #include "meanwhileprotocol.h"
+ #include "meanwhileplugin.h"
+
+-class MeanwhileLibrary;
++class MeanwhileSession;
+
++/**
++ * A class to handle a single Meanwhile Account.
++ */
+ class MeanwhileAccount : public Kopete::PasswordedAccount
+ {
+ Q_OBJECT
+ public:
+- MeanwhileAccount( MeanwhileProtocol *parent,
+- const QString &accountID,
+- const char *name = 0L);
++ /**
++ * Create a new Meanwhile account
++ * @param protocol The MeanwhileProtocol that this acccount is for
++ * @param accountID The (meanwhile) account id of this account
++ * @param name The name of this account
++ */
++ MeanwhileAccount(MeanwhileProtocol *protocol, const QString &accountID,
++ const char *name = 0L);
+
+ ~MeanwhileAccount();
+
+@@ -40,49 +48,65 @@
+ virtual void connectWithPassword(const QString &password);
+
+ virtual void disconnect();
+- virtual void disconnect(Kopete::Account::DisconnectReason reason);
+
+- virtual void setAway(bool away,
+- const QString &reason);
++ virtual void disconnect(Kopete::Account::DisconnectReason reason);
+
+ virtual KActionMenu *actionMenu();
+
+- QString serverName();
+- int serverPort();
++ /** Get the server host name */
++ QString getServerName();
++ /** Get the server port */
++ int getServerPort();
++ /** Set the server host name */
+ void setServerName(const QString &server);
++ /** Set the server port */
+ void setServerPort(int port);
++ /** Provide an information plugin for this account */
+ void setPlugin(MeanwhilePlugin *plugin);
+
+ MeanwhilePlugin *infoPlugin;
+
+ /**
+- * Get a reference to the meanwhile library object
++ * Save the current contact list to the server
+ */
+- MeanwhileLibrary *library();
++ void syncContactsToServer();
+
+-protected slots:
+- void meanwhileGoOnline();
+- void meanwhileGoAway();
+- void meanwhileGoOffline();
+- void meanwhileGoDND();
+- void meanwhileChangeStatus();
++ /**
++ * Get a reference to the meanwhile session object, if one exists
++ */
++ MeanwhileSession *session();
++
++ /**
++ * Get the meanwhile id for this account
++ * @return The meanwhile ID for the account
++ */
++ QString meanwhileId() const;
+
+ public slots:
+- void slotLoginDone();
++ /**
++ * Called by the session to notify that the state has changed
++ */
++ void slotSessionStateChange(Kopete::OnlineStatus status);
++
++ /**
++ * Called by the session when a notification message has been received
++ */
+ void slotServerNotification(const QString &mesg);
+- void slotConnectionLost();
+
+ /** Reimplemented from Kopete::Account */
+ void setOnlineStatus(const Kopete::OnlineStatus& status,
+ const QString &reason = QString::null);
++ void setAway(bool away, const QString&reason = QString::null);
+
+ private:
+- void initLibrary();
+- void meanwhileGoAway(const QString &statusmsg);
+- QString statusMesg;
++ /** Current online status */
++ Kopete::OnlineStatus status;
++
++ /** A meanwhile session */
++ MeanwhileSession *m_session;
+
+- /** The interface to the libmeanwhile library */
+- MeanwhileLibrary *m_library;
++ /* The user id for this account */
++ QString m_meanwhileId;
+ };
+
+ #endif
+--- kde.orig/kopete/protocols/meanwhile/meanwhilecontact.cpp
++++ kde.patched/kopete/protocols/meanwhile/meanwhilecontact.cpp
+@@ -24,19 +24,20 @@
+ #include "kopetemetacontact.h"
+
+ #include "meanwhileprotocol.h"
+-#include "meanwhilelibrary.h"
++#include "meanwhilesession.h"
+ #include "meanwhileaccount.h"
+ #include "meanwhilecontact.h"
+ #include "meanwhileplugin.h"
+
+-MeanwhileContact::MeanwhileContact(QString _userId, QString _nickname,
+- MeanwhileAccount *_account, Kopete::MetaContact *_parent)
+- : Kopete::Contact(_account, _userId, _parent)
++MeanwhileContact::MeanwhileContact(QString userId, QString nickname,
++ MeanwhileAccount *account, Kopete::MetaContact *parent)
++ : Kopete::Contact(account, userId, parent)
+ {
+- setNickName(_nickname);
++ setNickName(nickname);
+ m_msgManager = 0L;
+- meanwhileId = _userId;
+- setOnlineStatus( MeanwhileProtocol::protocol()->meanwhileOffline );
++ m_meanwhileId = userId;
++ setOnlineStatus(static_cast<MeanwhileProtocol *>(account->protocol())
++ ->statusOffline);
+ }
+
+ MeanwhileContact::~MeanwhileContact()
+@@ -45,23 +46,15 @@
+
+ bool MeanwhileContact::isReachable()
+ {
+- return true;
++ return isOnline();
+ }
+
+-void MeanwhileContact::serialize(
+- QMap< QString,
+- QString > &serializedData,
+- QMap< QString,
+- QString > & addressBookData )
++void MeanwhileContact::serialize(QMap<QString, QString> &serializedData,
++ QMap<QString, QString> &addressBookData)
+ {
+ Kopete::Contact::serialize(serializedData, addressBookData);
+ }
+
+-QPtrList<KAction> *MeanwhileContact::customContextMenuActions()
+-{
+- return 0L;
+-}
+-
+ void MeanwhileContact::showContactSettings()
+ {
+ }
+@@ -69,12 +62,12 @@
+ void MeanwhileContact::slotUserInfo()
+ {
+ MeanwhileAccount *theAccount = static_cast<MeanwhileAccount *>( account());
+- theAccount->infoPlugin->showUserInfo(meanwhileId);
++ theAccount->infoPlugin->showUserInfo(m_meanwhileId);
+ }
+
+ Kopete::ChatSession* MeanwhileContact::manager(CanCreateFlags canCreate)
+ {
+- if (m_msgManager || canCreate == Kopete::Contact::CannotCreate)
++ if (m_msgManager != 0L || canCreate == Kopete::Contact::CannotCreate)
+ return m_msgManager;
+
+ QPtrList<Kopete::Contact> contacts;
+@@ -95,36 +88,41 @@
+ return m_msgManager;
+ }
+
++QString MeanwhileContact::meanwhileId() const
++{
++ return m_meanwhileId;
++}
++
+ void MeanwhileContact::sendMessage(Kopete::Message &message)
+ {
+- /*
+- Kopete::ChatSession *manager = this->manager(Kopete::Contact::CanCreate);
+- */
+- static_cast<MeanwhileAccount *>(account())->library()->sendMessage(message);
++ static_cast<MeanwhileAccount *>(account())->session()->sendMessage(message);
+ }
+
+ void MeanwhileContact::slotSendTyping(bool isTyping)
+ {
+- static_cast<MeanwhileAccount *>(account())->library()->
++ static_cast<MeanwhileAccount *>(account())->session()->
+ sendTyping(this, isTyping);
+ }
+-
+-void MeanwhileContact::receivedMessage( const QString &message )
++
++void MeanwhileContact::receivedMessage(const QString &message)
+ {
+- Kopete::Message *newMessage;
+ Kopete::ContactPtrList contactList;
+- account();
+- contactList.append( account()->myself() );
+- newMessage = new Kopete::Message( this, contactList,
+- message, Kopete::Message::Inbound );
++ contactList.append(account()->myself());
++ Kopete::Message kmessage(this, contactList, message,
++ Kopete::Message::Inbound);
+
+- manager(Kopete::Contact::CanCreate)->appendMessage (*newMessage);
++ manager(Kopete::Contact::CanCreate)->appendMessage(kmessage);
++}
+
+- delete newMessage;
++void MeanwhileContact::sync(unsigned int changed)
++{
++ if (changed)
++ static_cast<MeanwhileAccount *>(account())->syncContactsToServer();
+ }
+
+ void MeanwhileContact::slotChatSessionDestroyed()
+ {
++ m_msgManager->deref();
+ m_msgManager = 0L;
+ }
+
+--- kde.orig/kopete/protocols/meanwhile/meanwhilecontact.h
++++ kde.patched/kopete/protocols/meanwhile/meanwhilecontact.h
+@@ -30,40 +30,39 @@
+
+ class MeanwhileContact : public Kopete::Contact
+ {
+- Q_OBJECT
++ Q_OBJECT
+ public:
+
+- MeanwhileContact( QString userId,
+- QString nickname,
+- MeanwhileAccount *account,
+- Kopete::MetaContact *parent);
+- ~MeanwhileContact();
++ MeanwhileContact(QString userId, QString nickname,
++ MeanwhileAccount *account, Kopete::MetaContact *parent);
++ ~MeanwhileContact();
+
+- virtual bool isReachable();
++ virtual bool isReachable();
+
+- virtual void serialize(QMap<QString, QString> &serializedData, QMap<QString, QString> &addressBookData);
++ virtual void serialize(QMap<QString, QString> &serializedData,
++ QMap<QString, QString> &addressBookData);
+
+- virtual QPtrList<KAction> *customContextMenuActions();
++ virtual Kopete::ChatSession *manager(
++ CanCreateFlags canCreate = CanCreate);
+
+- virtual Kopete::ChatSession *manager( CanCreateFlags canCreate = CanCreate );
++ QString meanwhileId() const;
+
+- QString meanwhileId;
++ virtual void sync(unsigned int changed = 0xff);
+
+ public slots:
+
+- void sendMessage( Kopete::Message &message );
+- void receivedMessage( const QString &message );
+- virtual void slotUserInfo();
++ void sendMessage( Kopete::Message &message );
++ void receivedMessage( const QString &message );
++ virtual void slotUserInfo();
+
+ protected slots:
+- void showContactSettings();
+- void slotChatSessionDestroyed();
+- void slotSendTyping(bool isTyping);
++ void showContactSettings();
++ void slotChatSessionDestroyed();
++ void slotSendTyping(bool isTyping);
+
+-protected:
+- Kopete::ChatSession *m_msgManager;
+- KActionCollection *m_actionCollection;
+- KAction* m_actionPrefs;
++private:
++ QString m_meanwhileId;
++ Kopete::ChatSession *m_msgManager;
+ };
+
+ #endif
+--- kde.orig/kopete/protocols/meanwhile/meanwhileeditaccountwidget.cpp
++++ kde.patched/kopete/protocols/meanwhile/meanwhileeditaccountwidget.cpp
+@@ -48,8 +48,8 @@
+ mPasswordWidget->load(&static_cast<MeanwhileAccount*>(account())->password());
+ mAutoConnect->setChecked(account()->excludeConnect());
+ MeanwhileAccount *myAccount = static_cast<MeanwhileAccount *>(account());
+- mServerName->setText(myAccount->serverName());
+- mServerPort->setValue(myAccount->serverPort());
++ mServerName->setText(myAccount->getServerName());
++ mServerPort->setValue(myAccount->getServerPort());
+ }
+ else
+ {
+@@ -70,9 +70,7 @@
+ Kopete::Account* MeanwhileEditAccountWidget::apply()
+ {
+ if(!account())
+- setAccount(
+- new MeanwhileAccount(
+- MeanwhileProtocol::protocol(), mScreenName->text()));
++ setAccount(new MeanwhileAccount(protocol, mScreenName->text()));
+
+ MeanwhileAccount *myAccount = static_cast<MeanwhileAccount *>(account());
+
+--- kde.orig/kopete/protocols/meanwhile/meanwhilelibrary.cpp
++++ kde.patched/kopete/protocols/meanwhile/meanwhilelibrary.cpp
+@@ -1,777 +0,0 @@
+-/*
+- meanwhilelibrary.cpp - interface to the 'C' meanwhile library
+-
+- Copyright (c) 2003-2004 by Sivaram Gottimukkala <suppandi at gmail.com>
+- Copyright (c) 2005 by Jeremy Kerr <jk at ozlabs.org>
+-
+- Kopete (c) 2002-2004 by the Kopete developers <kopete-devel at kde.org>
+-
+- *************************************************************************
+- * *
+- * 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 <string.h>
+-#include <stdlib.h>
+-#include <kmessagebox.h>
+-#include <klocale.h>
+-
+-#include <kopetepassword.h>
+-#include "meanwhilelibrary.h"
+-#include "meanwhileprotocol.h"
+-
+-extern "C"
+-{
+-#include <meanwhile/mw_channel.h>
+-#include <meanwhile/mw_message.h>
+-#include <meanwhile/mw_error.h>
+-#include <meanwhile/mw_service.h>
+-#include <meanwhile/mw_session.h>
+-#include <meanwhile/mw_srvc_aware.h>
+-#include <meanwhile/mw_srvc_conf.h>
+-#include <meanwhile/mw_srvc_im.h>
+-#include <meanwhile/mw_cipher.h>
+-}
+-
+-#define ADVERTISE_KOPETE(s) (s+" *using kopete")
+-
+-/* for these macros:
+- * func - the name of the function
+- * args - the full arguments (including type) of the member (and static)
+- * function. Must be enclosed in brackets. The first argument will be
+- * used to get a reference to the library - it must be named as per
+- * the last word of the macro name (but in lower case)
+- * call - the arguments to the call to the non-static function. This is the
+- * same as 'args', but without the type delcarations
+- */
+-
+-#define MEANWHILE_HOOK_SESSION(func, args, call) \
+-void MeanwhileLibrary::_ ## func args \
+-{ \
+- MeanwhileLibrary *lib = (MeanwhileLibrary *) \
+- mwSession_getClientData(session); \
+- if (lib) \
+- lib-> func call; \
+- else \
+- mwDebug() << "No client data for session in " #func << endl; \
+-} \
+-void MeanwhileLibrary:: func args
+-
+-#define MEANWHILE_HOOK_SERVICE(func, args, call) \
+-void MeanwhileLibrary::_ ## func args \
+-{ \
+- MeanwhileLibrary *lib = (MeanwhileLibrary *) \
+- mwService_getClientData((struct mwService *)service); \
+- if (lib) \
+- lib-> func call; \
+- else \
+- mwDebug() << "No client data for service in " #func << endl; \
+-} \
+-void MeanwhileLibrary:: func args
+-
+-#define MEANWHILE_HOOK_CONVERSATION(func, args, call) \
+-void MeanwhileLibrary::_ ## func args \
+-{ \
+- struct mwService *service = (struct mwService *) \
+- mwConversation_getService(conv); \
+- MeanwhileLibrary *lib = (MeanwhileLibrary *) \
+- mwService_getClientData(service); \
+- if (lib) \
+- lib-> func call; \
+- else \
+- mwDebug() << "No client data for conv. in " #func << endl; \
+-} \
+-void MeanwhileLibrary:: func args
+-
+-void MeanwhileLibrary::_stateChange(struct mwSession *session,
+- enum mwSessionState state, guint32 data)
+-{
+- HERE;
+- MeanwhileLibrary *lib =
+- (MeanwhileLibrary *)mwSession_getClientData(session);
+-
+- if (lib == 0L) {
+- mwDebug() << "Invalid handler in stateChange callback"
+- << endl;
+- return;
+- }
+-
+- switch (state) {
+- case mwSession_LOGIN_ACK:
+- lib->session_loginAck(session);
+- break;
+-
+- case mwSession_STOPPED:
+- lib->session_stop(session, data);
+- break;
+-
+- default:
+- mwDebug() << "Unhandled state change " << state << endl;
+- }
+-
+-}
+-
+-void MeanwhileLibrary::_handler_clear(struct mwSession *)
+-{
+- HERE;
+-}
+-
+-void MeanwhileLibrary::session_loginAck(struct mwSession *s)
+-{
+- HERE;
+- connected = true;
+- struct mwUserStatus stat = { mwStatus_ACTIVE, 0, 0L };
+- mwSession_setUserStatus(s, &stat);
+-
+- /* get own nickname */
+- struct mwLoginInfo *logininfo = mwSession_getLoginInfo(s);
+- if (logininfo) {
+- mwDebug() << "got login info. username: " << logininfo->user_name <<
+- ", nickname: " << getNickName(logininfo) << endl;
+- account->myself()->setNickName(getNickName(logininfo));
+- } else
+- mwDebug() << "no login info" << endl;
+-
+- emit loginDone();
+-}
+-
+-void MeanwhileLibrary::session_stop(struct mwSession *, unsigned int status)
+-{
+- HERE;
+- connected = false;
+- if (status & ERR_FAILURE) {
+- if (status == INCORRECT_LOGIN)
+- account->password().setWrong();
+- char *reason = mwError(status);
+- emit serverNotification(QString(reason));
+- free(reason);
+- }
+-
+- emit connectionLost();
+-}
+-
+-/* aware attribute handlers */
+-void MeanwhileLibrary::_on_attrib(struct mwServiceAware *,
+- struct mwAwareAttribute *)
+-{
+- HERE;
+-}
+-void MeanwhileLibrary::_attrib_clear(struct mwServiceAware *)
+-{
+- HERE;
+-}
+-
+-/* aware list handlers */
+-void MeanwhileLibrary::_on_aware(struct mwAwareList *list,
+- struct mwAwareSnapshot *id)
+-{
+- HERE;
+- MeanwhileLibrary *lib = (MeanwhileLibrary *)
+- mwAwareList_getClientData(list);
+- if (lib)
+- lib->on_aware(list, id);
+-}
+-
+-#define STATUS(VALUE,onlinestatus) \
+- (snapshot->status.status==MeanwhileLibrary::VALUE)? \
+- MeanwhileProtocol::protocol()->onlinestatus:
+-void MeanwhileLibrary::on_aware(struct mwAwareList *,
+- struct mwAwareSnapshot *snapshot)
+-{
+- HERE;
+- MeanwhileContact *contact = static_cast<MeanwhileContact *>
+- (account->contacts()[snapshot->id.user]);
+-
+- if (!contact)
+- return;
+-
+- contact->setProperty(MeanwhileProtocol::protocol()->statusMessage,
+- snapshot->status.desc);
+- contact->setProperty(MeanwhileProtocol::protocol()->awayMessage,
+- snapshot->status.desc);
+-
+- Kopete::OnlineStatus status;
+- if (snapshot->online) {
+- switch (snapshot->status.status) {
+- case MeanwhileLibrary::Away:
+- status = MeanwhileProtocol::protocol()->meanwhileAway;
+- break;
+- case MeanwhileLibrary::Active:
+- status = MeanwhileProtocol::protocol()->meanwhileOnline;
+- break;
+- case MeanwhileLibrary::Idle:
+- status = MeanwhileProtocol::protocol()->meanwhileIdle;
+- break;
+- case MeanwhileLibrary::Busy:
+- status = MeanwhileProtocol::protocol()->meanwhileBusy;
+- break;
+- default:
+- status = MeanwhileProtocol::protocol()->meanwhileUnknown;
+- }
+- } else {
+- status = MeanwhileProtocol::protocol()->meanwhileOffline;
+- }
+- contact->setOnlineStatus(status);
+-
+-#if 0
+- /* Commented out in previous kopete/meanwhile plugin for some reason,
+- * but has still been ported to the new API.
+- */
+- time_t idletime = 0;
+- if (snapshot->status.status == mwStatus_IDLE) {
+- idletime = (snapshot->status.time == 0xdeadbeef) ?
+- 0 : snapshot->status.time;
+- if (idletime != 0) {
+- contact->setStatusDescription(statusDesc + "[" +
+- QString::number(idletime/60)+" mins]");
+- }
+- } else
+- contact->setStatusDescription(snapshot->status.desc);
+-#endif
+-}
+-
+-void MeanwhileLibrary::_on_aware_attrib(struct mwAwareList *,
+- struct mwAwareIdBlock *,
+- struct mwAwareAttribute *)
+-{
+- mwDebug() << "_on_aware_attrib() called" << endl;
+-}
+-void MeanwhileLibrary::_aware_clear(struct mwAwareList *)
+-{
+- mwDebug() << "_aware_clear() called" << endl;
+-}
+-
+-QString MeanwhileLibrary::getNickName(struct mwLoginInfo *logininfo)
+-{
+- if (logininfo == 0L || logininfo->user_name == 0L)
+- return QString::null;
+-
+- /* try to find a friendly name. From what I've seen, usernames are in
+- * the format:
+- * <userid> - <name>/<domain>/<domain>
+- */
+- QString name = logininfo->user_name;
+- int index = name.find(" - ");
+- if (index != -1)
+- name = name.remove(0, index + 3);
+- index = name.find('/');
+- if (index != -1)
+- name = name.left(index);
+-
+- return name;
+-}
+-
+-MeanwhileContact *MeanwhileLibrary::convContact(
+- struct mwConversation *conv)
+-{
+- struct mwIdBlock *target = mwConversation_getTarget(conv);
+- if (target == 0L || target->user == 0L) {
+- return 0L;
+- }
+- QString user(target->user);
+-
+- MeanwhileContact *contact =
+- static_cast<MeanwhileContact *>(account->contacts()[user]);
+-
+- if (!contact) {
+- struct mwLoginInfo *logininfo = mwConversation_getTargetInfo(conv);
+- QString name = getNickName(logininfo);
+- account->addContact(user, name, 0L, Kopete::Account::Temporary);
+- contact = static_cast<MeanwhileContact *>(account->contacts()[user]);
+- }
+-
+- return contact;
+-}
+-
+-struct MeanwhileLibrary::conv_data *MeanwhileLibrary::initConvData(
+- struct mwConversation *conv, MeanwhileContact *contact)
+-{
+- struct conv_data *conv_data = (struct conv_data *)malloc(sizeof *conv_data);
+- if (!conv_data)
+- return 0L;
+-
+- conv_data->library = this;
+- /* grab a manager from the factory instead? */
+- conv_data->chat = contact->manager();
+- conv_data->chat->ref();
+- conv_data->queue = new QValueList<Kopete::Message>();
+-
+- mwConversation_setClientData(conv, conv_data, 0L);
+-
+- return conv_data;
+-}
+-
+-/* conversation */
+-MEANWHILE_HOOK_CONVERSATION(conversation_opened,
+- (struct mwConversation *conv),
+- (conv))
+-{
+- HERE;
+- MeanwhileContact *contact = convContact(conv);
+- if (!contact) {
+- mwDebug() << "Couldn't find contact!" << endl;
+- return;
+- }
+-
+- struct conv_data *conv_data =
+- (struct conv_data *)mwConversation_getClientData(conv);
+-
+- if (!conv_data && !(conv_data = initConvData(conv, contact))) {
+- return;
+-
+- } else if (conv_data->queue && !conv_data->queue->isEmpty()) {
+- /* send any messages that were waiting for the conversation to open */
+- QValueList<Kopete::Message>::iterator it;
+- for (it = conv_data->queue->begin(); it != conv_data->queue->end();
+- ++it) {
+- mwConversation_send(conv, mwImSend_PLAIN,
+- (*it).plainBody().ascii());
+- conv_data->chat->appendMessage(*it);
+- conv_data->chat->messageSucceeded();
+- }
+- conv_data->queue->clear();
+- }
+-}
+-
+-MEANWHILE_HOOK_CONVERSATION(conversation_closed,
+- (struct mwConversation *conv, guint32 err),
+- (conv, err))
+-{
+- HERE;
+- /* @todo err is unused. This'll eat the warning */
+- err = 0;
+- struct conv_data *conv_data =
+- (struct conv_data *)mwConversation_getClientData(conv);
+-
+- if (!conv_data)
+- return;
+-
+- mwConversation_setClientData(conv, 0L, 0L);
+- MeanwhileContact *contact = convContact(conv);
+- if (!contact) {
+- mwDebug() << "Couldn't find contact!" << endl;
+- return;
+- }
+-
+- conv_data->chat->removeContact(contact);
+- conv_data->chat->deref();
+- conv_data->chat = 0L;
+- free(conv_data);
+-}
+-
+-MEANWHILE_HOOK_CONVERSATION(conversation_recv,
+- (struct mwConversation *conv, enum mwImSendType type,
+- gconstpointer msg),
+- (conv, type, msg))
+-{
+- HERE;
+- struct conv_data *conv_data =
+- (struct conv_data *)mwConversation_getClientData(conv);
+-
+- if (!conv_data)
+- return;
+-
+- MeanwhileContact *contact = convContact(conv);
+- if (!contact) {
+- mwDebug() << "Couldn't find contact!" << endl;
+- return;
+- }
+-
+- switch (type) {
+- case mwImSend_PLAIN:
+- {
+- Kopete::Message message(contact, account->myself(),
+- QString((char *)msg), Kopete::Message::Inbound);
+- conv_data->chat->appendMessage(message);
+- }
+- break;
+- case mwImSend_TYPING:
+- conv_data->chat->receivedTypingMsg(contact);
+- break;
+- default:
+- mwDebug() << "Unable to handle message type " << type << endl;
+- }
+-}
+-
+-MEANWHILE_HOOK_SESSION(setUserStatus,
+- (struct mwSession *session),
+- (session))
+-{
+- struct mwLoginInfo *login;
+- struct mwUserStatus *status;
+-
+- HERE;
+- login = mwSession_getLoginInfo(session);
+- status = mwSession_getUserStatus(session);
+-
+- mwDebug() << "meanwhile status for " <<
+- ((login->user_id==0L) ?
+- "null" : login->user_id) <<
+- " changed to " << (status->status) << endl;
+-
+- struct mwAwareIdBlock id = {
+- mwAware_USER,
+- login->user_id,
+- login->community
+- };
+-
+- mwServiceAware_setStatus(srvc_aware, &id, status);
+-}
+-
+-MeanwhileLibrary::MeanwhileLibrary(MeanwhileAccount *a)
+-{
+- HERE;
+- account = a;
+- session = 0L;
+- connected = false;
+-}
+-
+-MeanwhileLibrary::~MeanwhileLibrary()
+-{
+- HERE;
+- if (connected)
+- logoff();
+- if (session)
+- mwSession_free(session);
+- if (socket)
+- delete socket;
+-}
+-
+-bool MeanwhileLibrary::isConnected()
+-{
+- HERE;
+- return connected;
+-}
+-
+-void MeanwhileLibrary::login()
+-{
+- HERE;
+- socket = getConnectedSocket();
+- if (socket == 0L) {
+- mwDebug() << "getConnectedSocket failed" << endl;
+- return;
+- }
+-
+- newSession();
+- mwSession_setProperty(session, mwSession_AUTH_USER_ID,
+- strdup(account->accountId().ascii()), 0L);
+- mwSession_setProperty(session, mwSession_AUTH_PASSWORD,
+- strdup(account->password().cachedValue().ascii()), 0L);
+-
+- mwSession_start(session);
+-}
+-
+-void MeanwhileLibrary::logoff()
+-{
+- HERE;
+- if (connected) {
+- mwSession_stop(session, ERR_SUCCESS);
+- }
+-}
+-
+-int MeanwhileLibrary::_writeToSocket(struct mwSession *session,
+- const char *buffer, gsize count)
+-{
+- HERE;
+- MeanwhileLibrary *lib =
+- (MeanwhileLibrary *)mwSession_getClientData(session);
+- return lib->writeToSocket(buffer, count);
+-}
+-
+-int MeanwhileLibrary::writeToSocket(const char *buffer, unsigned int count)
+-{
+- HERE;
+- int remaining, retval = 0;
+- for (remaining = count; remaining > 0; remaining -= retval) {
+- retval = socket->writeBlock(buffer, count);
+- if (retval <= 0)
+- return 1;
+- }
+- socket->flush();
+- return 0;
+-}
+-
+-void MeanwhileLibrary::_closeSocket(struct mwSession *session)
+-{
+- HERE;
+- MeanwhileLibrary *lib =
+- (MeanwhileLibrary *)mwSession_getClientData(session);
+- return lib->closeSocket();
+-}
+-
+-void MeanwhileLibrary::closeSocket()
+-{
+- HERE;
+- QObject::disconnect(socket, SIGNAL(closed(int)),
+- this, SLOT(slotSocketClosed(int)));
+- socket->flush();
+- socket->closeNow();
+-}
+-
+-void MeanwhileLibrary::newSession()
+-{
+- HERE;
+- /* set up the session handler */
+- memset(&session_handler, 0, sizeof(session_handler));
+- session_handler.io_write = _writeToSocket;
+- session_handler.io_close = _closeSocket;
+- session_handler.clear = _handler_clear;
+- session_handler.on_stateChange = _stateChange;
+-
+- /* create the session */
+- session = mwSession_new(&session_handler);
+- mwSession_setClientData(session, this, 0L);
+-
+-#if 0
+- session->on_setUserStatus = _on_setUserStatus;
+-#endif
+-
+- /* awareness service setup */
+- aware_handler.on_attrib = _on_attrib;
+- aware_handler.clear = _attrib_clear;
+- srvc_aware = mwServiceAware_new(session, &aware_handler);
+-
+- aware_list_handler.on_aware = _on_aware;
+- aware_list_handler.on_attrib = _on_aware_attrib;
+- aware_list_handler.clear = _aware_clear;
+-
+- aware_list = mwAwareList_new(srvc_aware, &aware_list_handler);
+- mwAwareList_setClientData(aware_list, this, 0L);
+-
+- mwService_setClientData((struct mwService *)srvc_aware, this, 0L);
+- mwSession_addService(session, (struct mwService *) srvc_aware);
+-
+- /* im service setup */
+- im_handler.conversation_opened = _conversation_opened;
+- im_handler.conversation_closed = _conversation_closed;
+- im_handler.conversation_recv = _conversation_recv;
+- im_handler.place_invite = 0L;
+- im_handler.clear = 0L;
+-
+- srvc_im = mwServiceIm_new(session, &im_handler);
+- mwService_setClientData((struct mwService *)srvc_im, this, 0L);
+- mwSession_addService(session, (struct mwService *) srvc_im);
+-
+-#if 0
+- /* FIXME: port to new API */
+- /* conference */
+- struct mwServiceConf *srvc_conf;
+- srvc_conf = mwServiceConf_new(session);
+- srvc_conf->got_invite = _got_invite;
+- srvc_conf->got_welcome = _got_welcome;
+- srvc_conf->got_closed = _got_closed;
+- srvc_conf->got_join = _got_join;
+- srvc_conf->got_part = _got_part;
+- srvc_conf->got_text = _got_conf_text;
+- srvc_conf->got_typing = _got_conf_typing;
+- mwSession_putService(session, (struct mwService *) srvc_conf);
+-#endif
+-
+- /* add a necessary cipher */
+- mwSession_addCipher(session, mwCipher_new_RC2_40(session));
+-}
+-
+-KExtendedSocket *MeanwhileLibrary::getConnectedSocket()
+-{
+- HERE;
+- KExtendedSocket *sock = new KExtendedSocket(account->serverName(),
+- account->serverPort(), KExtendedSocket::bufferedSocket);
+- int error = sock->connect();
+- if (error)
+- {
+- KMessageBox::queuedMessageBox(
+- 0, KMessageBox::Error ,
+- i18n( "Could not connect to server"),
+- i18n( "Meanwhile Plugin" ),
+- KMessageBox::Notify );
+- delete sock;
+- return 0L;
+- }
+- /* we want to receive signals when there is data to read */
+- sock->enableRead(true);
+- QObject::connect(sock, SIGNAL(readyRead()) ,
+- SLOT(slotSocketReader()));
+- QObject::connect(sock, SIGNAL(closed(int)),
+- SLOT(slotSocketClosed(int)));
+- return sock;
+-}
+-
+-void MeanwhileLibrary::slotSocketReader()
+-{
+- HERE;
+- char buffer[4000];
+- int readAmount;
+- readAmount = socket->readBlock(buffer,4000);
+- if (readAmount < 0)
+- return;
+- mwSession_recv(session, buffer, (unsigned int) readAmount);
+-}
+-
+-void MeanwhileLibrary::slotSocketClosed(int reason)
+-{
+- HERE;
+- connected = false;
+- if (reason == KExtendedSocket::involuntary) {
+- emit serverNotification(
+- QString("Lost connection with Meanwhile server"));
+- emit connectionLost();
+- }
+-}
+-
+-static void free_iter(void *data, void *p)
+-{
+- if (p != 0L)
+- return;
+- free(data);
+-}
+-
+-void MeanwhileLibrary::addContacts(const QDict<Kopete::Contact>& contacts)
+-{
+- HERE;
+- QDictIterator<Kopete::Contact> it(contacts);
+- GList *buddies = 0L;
+-
+- /** Convert our QDict of kopete contact to a GList of meanwhile buddies */
+- for( ; it.current(); ++it) {
+- struct mwAwareIdBlock *buddy = (struct mwAwareIdBlock *)
+- malloc(sizeof(*buddy));
+- MeanwhileContact *contact =
+- static_cast<MeanwhileContact *>(it.current());
+- if (buddy == 0L)
+- continue;
+- buddy->user = (gchar*)contact->meanwhileId.ascii();
+- buddy->community = 0L;
+- buddy->type = mwAware_USER;
+- mwDebug() << "Adding contact: '" << buddy->user << "'" << endl;
+- buddies = g_list_append(buddies, buddy);
+- }
+-
+- mwAwareList_addAware(aware_list, buddies);
+-
+- g_list_foreach(buddies, free_iter, 0L);
+- g_list_free(buddies);
+-}
+-
+-void MeanwhileLibrary::addContact(const Kopete::Contact *contact)
+-{
+- HERE;
+- char *targetID = strdup(static_cast<const MeanwhileContact*>(contact)
+- ->meanwhileId.ascii());
+- struct mwAwareIdBlock buddy =
+- { mwAware_USER, targetID, 0L };
+- GList *buddies = 0L;
+- g_list_insert(buddies, &buddy, 0);
+-
+- mwDebug() << "Adding contact: '" << buddy.user << "'" << endl;
+- mwAwareList_addAware(aware_list, buddies);
+- g_list_free(buddies);
+- free(targetID);
+-}
+-
+-int MeanwhileLibrary::sendMessage(Kopete::Message &message)
+-{
+- HERE;
+- MeanwhileContact *contact =
+- static_cast<MeanwhileContact *>(message.to().first());
+- if (!contact) {
+- mwDebug() << "No target for message!" <<endl;
+- return 0;
+- }
+-
+- char *targetID = strdup(contact->meanwhileId.ascii());
+- struct mwIdBlock target = { targetID, 0L };
+- struct mwConversation *conv;
+-
+- conv = mwServiceIm_getConversation(srvc_im, &target);
+- if (conv == 0L) {
+- mwDebug() << "No target for conversation with '" << targetID
+- << "'" << endl;
+- free(targetID);
+- return 0;
+- }
+- free(targetID);
+-
+- struct conv_data *conv_data = (struct conv_data *)
+- mwConversation_getClientData(conv);
+- if (!conv_data && !(conv_data = initConvData(conv, contact)))
+- return 0;
+-
+- /* if there's other messages in the queue, or the conversation isn't open,
+- * then append to the queue instead of sending right away */
+- if ((conv_data->queue && !conv_data->queue->isEmpty()) ||
+- !mwConversation_isOpen(conv)) {
+- conv_data->queue->append(message);
+- mwConversation_open(conv);
+-
+- } else if (!mwConversation_send(conv, mwImSend_PLAIN,
+- message.plainBody().ascii())) {
+- conv_data->chat->appendMessage(message);
+- conv_data->chat->messageSucceeded();
+- }
+- return 1;
+-}
+-
+-void MeanwhileLibrary::sendTyping(MeanwhileContact *contact, bool isTyping)
+-{
+- HERE;
+- char *targetID = strdup(contact->meanwhileId.ascii());
+- struct mwIdBlock target = { targetID, 0L };
+- struct mwConversation *conv;
+-
+- conv = mwServiceIm_getConversation(srvc_im, &target);
+- if (conv == 0L) {
+- mwDebug() << "No target for typing flag with '" << targetID << "'"
+- << endl;
+- free(targetID);
+- return;
+- }
+- free(targetID);
+-
+- if (mwConversation_isOpen(conv))
+- mwConversation_send(conv, mwImSend_TYPING, (void *)isTyping);
+-}
+-
+-void MeanwhileLibrary::setState(Kopete::OnlineStatus state,
+- const QString msg)
+-{
+- HERE;
+- if (state.internalStatus() == MeanwhileLibrary::Offline ||
+- state.internalStatus() == 0)
+- return;
+-
+- struct mwUserStatus stat;
+- mwUserStatus_clone(&stat, mwSession_getUserStatus(session));
+-
+- free(stat.desc);
+-
+- stat.status = (mwStatusType)state.internalStatus();
+- if (msg.isNull() || msg.isEmpty())
+- stat.desc = (gchar*)strdup(state.description().ascii());
+- else
+- stat.desc = (gchar*)strdup(msg.ascii());
+-
+- mwSession_setUserStatus(session,&stat);
+- mwUserStatus_clear(&stat);
+-}
+-
+-void MeanwhileLibrary::setStatusMesg(const QString &statusMesg)
+-{
+- HERE;
+- if(statusMesg.isNull())
+- return;
+- struct mwUserStatus stat;
+- mwUserStatus_clone(&stat, mwSession_getUserStatus(session));
+-
+- free(stat.desc);
+- stat.desc = (gchar*)strdup(ADVERTISE_KOPETE(statusMesg).ascii());
+-
+- mwSession_setUserStatus(session,&stat);
+- mwUserStatus_clear(&stat);
+-}
+-
+-#include "meanwhilelibrary.moc"
+--- kde.orig/kopete/protocols/meanwhile/meanwhilelibrary.h
++++ kde.patched/kopete/protocols/meanwhile/meanwhilelibrary.h
+@@ -1,295 +0,0 @@
+-/*
+- meanwhilelibrary.h - interface to the 'C' meanwhile library
+-
+- Copyright (c) 2003-2004 by Sivaram Gottimukkala <suppandi at gmail.com>
+- Copyright (c) 2005 by Jeremy Kerr <jk at ozlabs.org>
+-
+- Kopete (c) 2002-2004 by the Kopete developers <kopete-devel at kde.org>
+-
+- *************************************************************************
+- * *
+- * 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 MEANWHILELIBRARY_H
+-#define MEANWHILELIBRARY_H
+-
+-#include <qptrlist.h>
+-#include <qdict.h>
+-#include <qobject.h>
+-
+-#include <glib/ghash.h>
+-#include <kextsock.h>
+-
+-#include <kopetecontact.h>
+-#include <kopetechatsession.h>
+-#include <kopetemessage.h>
+-
+-#include "meanwhileaccount.h"
+-#include "meanwhilecontact.h"
+-
+-extern "C" {
+-#include <meanwhile/mw_session.h>
+-#include <meanwhile/mw_srvc_conf.h>
+-#include <meanwhile/mw_srvc_im.h>
+-#include <meanwhile/mw_srvc_aware.h>
+-}
+-
+-/**
+- * A class to handle the interface to the libmeanwhile code, currently using
+- * version 0.4.2
+- */
+-class MeanwhileLibrary : public QObject
+-{
+- Q_OBJECT
+-
+-public:
+- /**
+- * Create a library. By default, the library is not connected - you will
+- * need to call login() to initiate the connection process.
+- * @param account The account that the connection is for
+- */
+- MeanwhileLibrary(MeanwhileAccount *account);
+-
+- /**
+- * Destroy the library
+- */
+- ~MeanwhileLibrary();
+-
+- /**
+- * Determine whether the library is connected and logged in
+- * @return true if there is a logged-in session with the meanwhile server
+- */
+- bool isConnected();
+-
+- /**
+- * Log in to the server. This will open a socket and start login. Note that
+- * the connection process is ascychronous - a loginDone() signal will be
+- * emitted when sucessfully logged in.
+- */
+- void login();
+-
+- /**
+- * Log off
+- */
+- void logoff();
+-
+- /**
+- * Register contacts for presence updates
+- * @param contacts A set of contacts to add
+- */
+- void addContacts(const QDict<Kopete::Contact> &contacts);
+-
+- /**
+- * Register a single contact for presence awareness
+- * @param contact a contact to add
+- */
+- void addContact(const Kopete::Contact *contact);
+-
+- /**
+- * Send a typing notification to a single contact
+- * @param contact The contact that is being typed to
+- * @param isTyping true if a typing message is to be sent
+- */
+- void sendTyping(MeanwhileContact *contact, bool isTyping);
+-
+- /**
+- * Send a message to a contact. If a conversation is not yet open to the
+- * message's recipient, the message will be queued until a conversation has
+- * become open (we also tell the conversation to open, so it should happen
+- * in the near future). The library will call appendMessage() and
+- * messageSuccceeded() when the message has been sent.
+- * @param message The message to send
+- * @return non-zero if the message was sent OK
+- */
+- int sendMessage(Kopete::Message &message);
+-
+- /**
+- * Set our (the local contact's) online status. The internalStatus of the
+- * state argument will be used to define the state message we send - it
+- * should be one of the Status enum fields (and not Offline)
+- * @param state the new state of the local user
+- * @param msg a custom message to use, if required
+- */
+- void setState(Kopete::OnlineStatus state,
+- const QString msg = QString::null);
+-
+- /**
+- * Set the status description of the local user
+- * @param statusMesg a description of the local sataus
+- */
+- void setStatusMesg(const QString &statusMesg);
+-
+- /**
+- * Allowed states for the meanwhile protocol.
+- */
+- enum Status {
+- Active = mwStatus_ACTIVE, /**< active/online */
+- Away = mwStatus_AWAY, /**< away */
+- Idle = mwStatus_IDLE, /**< idle */
+- Busy = mwStatus_BUSY, /**< busy */
+- Offline = 0xffff /**< offline. */
+- };
+-
+-signals:
+- /**
+- * Emitted when the login process is complete
+- */
+- void loginDone();
+-
+- /**
+- * Emitted when the connection to the server has been lost
+- */
+- void connectionLost();
+-
+- /**
+- * Emitted when a notification is received from the server, or other
+- * out-of-band data (eg, the password is incorrect).
+- * @param mesgString A description of the notification
+- */
+- void serverNotification(const QString &mesgString);
+-
+-
+-private:
+- /** Session handler for general calls */
+- struct mwSessionHandler session_handler;
+- /** Aware list changes */
+- struct mwAwareListHandler aware_list_handler;
+- /** Aware attribute changes */
+- struct mwAwareHandler aware_handler;
+- /** Instant message handler */
+- struct mwImHandler im_handler;
+-
+-
+- /* session handler callbacks */
+- static void _stateChange(struct mwSession *s,
+- enum mwSessionState state, guint32 info);
+-
+- static void _handler_clear(struct mwSession *s);
+-
+- /* individual state change functions */
+- void session_loginAck(mwSession *s);
+- void session_stop(mwSession *s, unsigned int status);
+-
+- static int _writeToSocket(struct mwSession *session,
+- const char *buffer, gsize count);
+- int writeToSocket(const char *buffer, unsigned int count);
+-
+- static void _closeSocket(struct mwSession *session);
+- void closeSocket();
+-
+-#define DEFINE_MW_HOOK(func) \
+-static void _ ## func; \
+-void func
+-
+- DEFINE_MW_HOOK(setUserStatus(mwSession *s));
+-
+- /* aware attribute handlers */
+- static void _on_attrib(struct mwServiceAware *srvc,
+- struct mwAwareAttribute *attrib);
+- static void _attrib_clear(struct mwServiceAware *srvc);
+-
+- /* aware list handlers */
+- DEFINE_MW_HOOK(on_aware(struct mwAwareList *list,
+- struct mwAwareSnapshot *id));
+- static void _on_aware_attrib(struct mwAwareList *list,
+- struct mwAwareIdBlock *id,
+- struct mwAwareAttribute *attrib);
+- static void _aware_clear(struct mwAwareList *list);
+-
+- /* conversation handlers */
+- DEFINE_MW_HOOK(conversation_opened(struct mwConversation *conv));
+- DEFINE_MW_HOOK(conversation_closed(struct mwConversation *conv,
+- guint32 err));
+- DEFINE_MW_HOOK(conversation_recv(struct mwConversation *conv,
+- enum mwImSendType type, gconstpointer msg));
+-
+- /**
+- * A structure to put into the private data of a conversation (and a
+- * conference, later). Since the callbacks that we give to the
+- * meanwhile library need to be static, we put a pointer to one of
+- * these in the conversation's private data.
+- */
+- struct conv_data {
+- MeanwhileLibrary *library; /**< The library for this conv. */
+- Kopete::ChatSession *chat; /**< The chatsession for this conv. */
+- QValueList<Kopete::Message> *queue; /**< Unsent message queue */
+- };
+-
+- /**
+- * Convenience method to set a conversation's private data, with a new
+- * conv_data struct. The conv_data should be free()ed when no longer
+- * required.
+- * @param conv The new conversation
+- * @param contact The remote contact for this conversation
+- * @return The new conv_data structure for this conversation
+- */
+- struct conv_data *initConvData(struct mwConversation *conv,
+- MeanwhileContact *contact);
+-
+- /**
+- * Find the MeanwhileContact for a conversation
+- * @param conv The conversation
+- * @return the MeanwhileContact on the other side of this conversation
+- */
+- MeanwhileContact *convContact(struct mwConversation *conv);
+-
+- /**
+- * Parse a friendly name from a mwLoginInfo struct
+- * @param logininfo The login info struct for the user
+- * @return the user name (ie full name), or QString::null if none could
+- * be parsed.
+- */
+- static QString getNickName(struct mwLoginInfo *logininfo);
+-
+- /**
+- * Initialise the session handlers for a library.
+- */
+- void newSession();
+-
+- /**
+- * Create a connected socket to the server (defined by the account object)
+- * @return a connected socket
+- */
+- KExtendedSocket *getConnectedSocket();
+-
+-
+- /** The kopete account that this library is for */
+- MeanwhileAccount *account;
+-
+- /** The meanwhile session that we're connected to */
+- struct mwSession *session;
+-
+- /** The aware service */
+- struct mwServiceAware *srvc_aware;
+-
+- /** Aware list */
+- struct mwAwareList *aware_list;
+-
+- /** IM service */
+- struct mwServiceIm *srvc_im;
+-
+- /** socket to the server */
+- KExtendedSocket *socket;
+-
+- /** connected (& logged in) flag */
+- bool connected;
+-
+-private slots:
+-
+- /** Notify the library that data is available on the socket */
+- void slotSocketReader();
+-
+- /**
+- * Notify the library that the socket has been closed
+- * @param reason the reason for closing
+- */
+- void slotSocketClosed(int reason);
+-};
+-
+-#endif
+-
+--- kde.orig/kopete/protocols/meanwhile/meanwhileprotocol.cpp
++++ kde.patched/kopete/protocols/meanwhile/meanwhileprotocol.cpp
+@@ -18,89 +18,76 @@
+ #include "meanwhileaddcontactpage.h"
+ #include "meanwhileeditaccountwidget.h"
+ #include "meanwhileaccount.h"
+-#include "meanwhilelibrary.h"
+ #include <kgenericfactory.h>
+ #include "kopeteaccountmanager.h"
+ #include "kopeteglobal.h"
+ #include "kopeteonlinestatusmanager.h"
+
+-MeanwhileProtocol *MeanwhileProtocol::s_protocol = 0L;
++#include "mw_common.h"
+
+ typedef KGenericFactory<MeanwhileProtocol> MeanwhileProtocolFactory;
+-K_EXPORT_COMPONENT_FACTORY(
+- kopete_meanwhile,
+- MeanwhileProtocolFactory( "kopete_meanwhile" ))
+-
+-MeanwhileProtocol::MeanwhileProtocol( QObject* parent,
+- const char *name,
+- const QStringList &/*args*/)
+- : Kopete::Protocol(MeanwhileProtocolFactory::instance(),
+- parent, name),
+-
+- meanwhileOffline(Kopete::OnlineStatus::Offline, 25, this,
+- MeanwhileLibrary::Offline,
+- QString::null, i18n( "Offline" ), i18n( "Go Offline" ),
+- Kopete::OnlineStatusManager::Offline),
+-
+- meanwhileOnline(Kopete::OnlineStatus::Online, 25, this,
+- MeanwhileLibrary::Active, QString::null, i18n( "Online" ),
+- i18n( "Go Online" ), Kopete::OnlineStatusManager::Online),
+-
+- meanwhileAway(Kopete::OnlineStatus::Away, 25, this,
+- MeanwhileLibrary::Away, "meanwhile_away", i18n( "Away" ),
+- i18n( "Go Away" ), Kopete::OnlineStatusManager::Away),
+-
+- meanwhileBusy(Kopete::OnlineStatus::Away, 25, this,
+- MeanwhileLibrary::Busy, "meanwhile_dnd",
+- i18n( "Busy" ) , i18n( "Mark as Busy" ),
+- Kopete::OnlineStatusManager::Busy),
+-
+- meanwhileIdle(Kopete::OnlineStatus::Away, 25, this,
+- MeanwhileLibrary::Idle, "meanwhile_idle",
+- i18n( "Idle" ), i18n( "Marked as Idle" ),
+- Kopete::OnlineStatusManager::Idle),
+-
+- meanwhileUnknown(Kopete::OnlineStatus::Unknown, 25, this, 0,
+- "meanwhile_unknown", i18n( "Catch me if you can" )),
+-
+- statusMessage(QString::fromLatin1("statusMessage"),
+- i18n("Status Message"), QString::null, false, true),
+- awayMessage(Kopete::Global::Properties::self()->awayMessage())
++K_EXPORT_COMPONENT_FACTORY(kopete_meanwhile,
++ MeanwhileProtocolFactory("kopete_meanwhile"))
++
++MeanwhileProtocol::MeanwhileProtocol(QObject* parent, const char *name,
++ const QStringList &/*args*/)
++: Kopete::Protocol(MeanwhileProtocolFactory::instance(), parent, name),
++
++ statusOffline(Kopete::OnlineStatus::Offline, 25, this, 0, QString::null,
++ i18n("Offline"), i18n("Offline"),
++ Kopete::OnlineStatusManager::Offline,
++ Kopete::OnlineStatusManager::DisabledIfOffline),
++
++ statusOnline(Kopete::OnlineStatus::Online, 25, this, mwStatus_ACTIVE,
++ QString::null, i18n("Online"), i18n("Online"),
++ Kopete::OnlineStatusManager::Online, 0),
++
++ statusAway(Kopete::OnlineStatus::Away, 20, this, mwStatus_AWAY,
++ "meanwhile_away", i18n("Away"), i18n("Away"),
++ Kopete::OnlineStatusManager::Away,
++ Kopete::OnlineStatusManager::HasAwayMessage),
++
++ statusBusy(Kopete::OnlineStatus::Away, 25, this, mwStatus_BUSY,
++ "meanwhile_dnd", i18n("Busy"), i18n("Busy"),
++ Kopete::OnlineStatusManager::Busy,
++ Kopete::OnlineStatusManager::HasAwayMessage),
++
++ statusIdle(Kopete::OnlineStatus::Away, 30, this, mwStatus_AWAY,
++ "meanwhile_idle", i18n("Idle"), i18n("Idle"),
++ Kopete::OnlineStatusManager::Idle, 0),
++
++ statusAccountOffline(Kopete::OnlineStatus::Offline, 0, this, 0,
++ QString::null, i18n("Account Offline")),
++
++ statusMessage(QString::fromLatin1("statusMessage"),
++ i18n("Status Message"), QString::null, false, true),
++
++ awayMessage(Kopete::Global::Properties::self()->awayMessage())
+ {
+-// LOG("MeanwhileProtocol()");
+- s_protocol = this;
++ HERE;
+
+- addAddressBookField( "messaging/meanwhile", Kopete::Plugin::MakeIndexField );
++ addAddressBookField("messaging/meanwhile", Kopete::Plugin::MakeIndexField);
+ }
+
+ MeanwhileProtocol::~MeanwhileProtocol()
+ {
+ }
+
+-AddContactPage * MeanwhileProtocol::createAddContactWidget(
+- QWidget *parent,
+- Kopete::Account * account )
++AddContactPage * MeanwhileProtocol::createAddContactWidget(QWidget *parent,
++ Kopete::Account *account )
+ {
+ return new MeanwhileAddContactPage(parent, account);
+ }
+
+-KopeteEditAccountWidget * MeanwhileProtocol::createEditAccountWidget(
+- Kopete::Account *account,
+- QWidget *parent )
+-{
+-// LOG("createEditAccountWidget");
+- return new MeanwhileEditAccountWidget( parent, account, this );
+-}
+-
+-Kopete::Account *MeanwhileProtocol::createNewAccount(
+- const QString &accountId )
++KopeteEditAccountWidget * MeanwhileProtocol::createEditAccountWidget(
++ Kopete::Account *account, QWidget *parent )
+ {
+- return new MeanwhileAccount( this, accountId, accountId.ascii() );
++ return new MeanwhileEditAccountWidget(parent, account, this);
+ }
+
+-MeanwhileProtocol *MeanwhileProtocol::protocol()
++Kopete::Account *MeanwhileProtocol::createNewAccount(const QString &accountId)
+ {
+- return s_protocol;
++ return new MeanwhileAccount(this, accountId, accountId.ascii());
+ }
+
+ Kopete::Contact *MeanwhileProtocol::deserializeContact(
+@@ -115,7 +102,7 @@
+ MeanwhileAccount *theAccount =
+ static_cast<MeanwhileAccount*>(
+ Kopete::AccountManager::self()->
+- findAccount(protocol()->pluginId(), accountId));
++ findAccount(pluginId(), accountId));
+
+ if(!theAccount)
+ {
+@@ -126,5 +113,14 @@
+ return theAccount->contacts()[contactId];
+ }
+
++const Kopete::OnlineStatus MeanwhileProtocol::accountOfflineStatus()
++{
++ return statusAccountOffline;
++}
+
++const Kopete::OnlineStatus MeanwhileProtocol::lookupStatus(
++ enum Kopete::OnlineStatusManager::Categories cats)
++{
++ return Kopete::OnlineStatusManager::self()->onlineStatus(this, cats);
++}
+ #include "meanwhileprotocol.moc"
+--- kde.orig/kopete/protocols/meanwhile/meanwhileprotocol.h
++++ kde.patched/kopete/protocols/meanwhile/meanwhileprotocol.h
+@@ -1,6 +1,7 @@
+ /*
+ meanwhileprotocl.h - the meanwhile protocol definition
+
++ Copyright (c) 2005 by Jeremy Kerr <jk at ozlabs.org>
+ Copyright (c) 2003-2004 by Sivaram Gottimukkala <suppandi at gmail.com>
+
+ Kopete (c) 2002-2004 by the Kopete developers <kopete-devel at kde.org>
+@@ -22,6 +23,7 @@
+ #include "kopetecontact.h"
+ #include "kopetemetacontact.h"
+ #include "kopeteonlinestatus.h"
++#include "kopeteonlinestatusmanager.h"
+ #include "addcontactpage.h"
+
+ #include <kdebug.h>
+@@ -37,44 +39,39 @@
+ {
+ Q_OBJECT
+ public:
+-/* const */
+- MeanwhileProtocol(QObject *parent,
+- const char *name,
+- const QStringList &args);
+-/* destructor */
++ MeanwhileProtocol(QObject *parent, const char *name,
++ const QStringList &args);
++
+ ~MeanwhileProtocol();
+-
+- virtual AddContactPage * createAddContactWidget(
+- QWidget *parent,
+- Kopete::Account *account );
+-
+- virtual KopeteEditAccountWidget * createEditAccountWidget(
+- Kopete::Account *account,
+- QWidget *parent );
+
+- virtual Kopete::Account * createNewAccount(
+- const QString &accountId );
++ virtual AddContactPage *createAddContactWidget(QWidget *parent,
++ Kopete::Account *account);
++
++ virtual KopeteEditAccountWidget *createEditAccountWidget(
++ Kopete::Account *account, QWidget *parent);
++
++ virtual Kopete::Account *createNewAccount(const QString &accountId);
+
+ virtual Kopete::Contact *deserializeContact(
+- Kopete::MetaContact *metaContact,
+- const QMap<QString,QString> &serializedData,
+- const QMap<QString, QString> &addressBookData );
+-
+- /* kopete doesnt know about these funcs */
+- static MeanwhileProtocol *protocol();
+-
+- const Kopete::OnlineStatus meanwhileOffline;
+- const Kopete::OnlineStatus meanwhileOnline;
+- const Kopete::OnlineStatus meanwhileAway;
+- const Kopete::OnlineStatus meanwhileBusy;
+- const Kopete::OnlineStatus meanwhileIdle;
+- const Kopete::OnlineStatus meanwhileUnknown;
++ Kopete::MetaContact *metaContact,
++ const QMap<QString,QString> &serializedData,
++ const QMap<QString, QString> &addressBookData);
++
++ const Kopete::OnlineStatus accountOfflineStatus();
++
++ const Kopete::OnlineStatus lookupStatus(
++ enum Kopete::OnlineStatusManager::Categories cats);
++
++ const Kopete::OnlineStatus statusOffline;
++ const Kopete::OnlineStatus statusOnline;
++ const Kopete::OnlineStatus statusAway;
++ const Kopete::OnlineStatus statusBusy;
++ const Kopete::OnlineStatus statusIdle;
++ const Kopete::OnlineStatus statusAccountOffline;
+
+- const Kopete::ContactPropertyTmpl statusMessage;
+- const Kopete::ContactPropertyTmpl awayMessage;
++ Kopete::ContactPropertyTmpl statusMessage;
++ Kopete::ContactPropertyTmpl awayMessage;
+
+-protected:
+- static MeanwhileProtocol *s_protocol;
+ };
+
+ #endif
+--- kde.orig/kopete/protocols/meanwhile/meanwhilesession.cpp
++++ kde.patched/kopete/protocols/meanwhile/meanwhilesession.cpp
+@@ -0,0 +1,899 @@
++/*
++ meanwhilesession.cpp - interface to the 'C' meanwhile library
++
++ Copyright (c) 2003-2004 by Sivaram Gottimukkala <suppandi at gmail.com>
++ Copyright (c) 2005 by Jeremy Kerr <jk at ozlabs.org>
++
++ Kopete (c) 2002-2004 by the Kopete developers <kopete-devel at kde.org>
++
++ *************************************************************************
++ * *
++ * 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 <string.h>
++#include <stdlib.h>
++#include <kmessagebox.h>
++#include <klocale.h>
++
++#include <kopetepassword.h>
++#include <kopetechatsession.h>
++#include <kopetegroup.h>
++#include <kopetecontactlist.h>
++#include "meanwhilesession.h"
++#include "meanwhileprotocol.h"
++
++#include <mw_channel.h>
++#include <mw_message.h>
++#include <mw_error.h>
++#include <mw_service.h>
++#include <mw_session.h>
++#include <mw_srvc_aware.h>
++#include <mw_srvc_conf.h>
++#include <mw_srvc_im.h>
++#include <mw_srvc_store.h>
++#include <mw_cipher.h>
++#include <mw_st_list.h>
++
++#define set_session_handler(a,b) sessionHandler.a = _handleSession ## b
++#define set_aware_handler(a,b) awareHandler.a = _handleAware ## b
++#define set_aware_list_handler(a,b) \
++ awareListHandler.a = _handleAwareList ## b
++#define set_im_handler(a,b) imHandler.a = _handleIm ## b
++
++#define get_protocol() (static_cast<MeanwhileProtocol *>(account->protocol()))
++
++MeanwhileSession::MeanwhileSession(MeanwhileAccount *account)
++{
++ HERE;
++ this->account = account;
++ session = 0L;
++ socket = 0L;
++ state = mwSession_STOPPED;
++
++ /* set up main session hander */
++ memset(&sessionHandler, 0, sizeof(sessionHandler));
++ set_session_handler(io_write, IOWrite);
++ set_session_handler(io_close, IOClose);
++ set_session_handler(on_stateChange, StateChange);
++ set_session_handler(on_setPrivacyInfo, SetPrivacyInfo);
++ set_session_handler(on_setUserStatus, SetUserStatus);
++ set_session_handler(on_admin, Admin);
++ set_session_handler(on_announce, Announce);
++ set_session_handler(clear, Clear);
++
++ session = mwSession_new(&sessionHandler);
++ mwSession_setClientData(session, this, 0L);
++
++ /* set up the aware service */
++ memset(&awareHandler, 0, sizeof(awareHandler));
++ set_aware_handler(on_attrib, Attrib);
++
++ awareService = mwServiceAware_new(session, &awareHandler);
++ mwSession_addService(session, (struct mwService *)awareService);
++
++ /* create an aware list */
++ memset(&awareListHandler, 0, sizeof(awareListHandler));
++ set_aware_list_handler(on_aware, Aware);
++ set_aware_list_handler(on_attrib, Attrib);
++ awareList = mwAwareList_new(awareService, &awareListHandler);
++ mwAwareList_setClientData(awareList, this, 0L);
++
++ /* set up an im service */
++ memset(&imHandler, 0, sizeof(imHandler));
++ set_im_handler(conversation_opened, ConvOpened);
++ set_im_handler(conversation_closed, ConvClosed);
++ set_im_handler(conversation_recv, ConvReceived);
++ imHandler.place_invite = 0L;
++ imHandler.clear = 0L;
++
++ imService = mwServiceIm_new(session, &imHandler);
++ mwService_setClientData((struct mwService *)imService, this, 0L);
++ mwSession_addService(session, (struct mwService *) imService);
++
++ /* add resolve service */
++ resolveService = mwServiceResolve_new(session);
++ mwService_setClientData((struct mwService *)resolveService, this, 0L);
++ mwSession_addService(session, (struct mwService *) resolveService);
++
++ /* storage service */
++ storageService = mwServiceStorage_new(session);
++ mwService_setClientData((struct mwService *)storageService, this, 0L);
++ mwSession_addService(session, (struct mwService *) storageService);
++
++#if 0
++ /* conference service setup - just declines invites for now. */
++ memset(&conf_handler, 0, sizeof(conf_handler));
++ conf_handler.on_invited = _conference_invite;
++
++ srvc_conf = mwServiceConference_new(session, &conf_handler);
++ mwService_setClientData((struct mwService *)srvc_conf, this, 0L);
++ mwSession_addService(session, (struct mwService *) srvc_conf);
++#endif
++
++ /* add a necessary cipher */
++ mwSession_addCipher(session, mwCipher_new_RC2_40(session));
++}
++
++MeanwhileSession::~MeanwhileSession()
++{
++ HERE;
++ if (isConnected() || isConnecting())
++ disconnect();
++
++ mwSession_removeService(session, mwService_STORAGE);
++ mwSession_removeService(session, mwService_RESOLVE);
++ mwSession_removeService(session, mwService_IM);
++ mwSession_removeService(session, mwService_AWARE);
++
++ mwAwareList_free(awareList);
++ mwService_free(MW_SERVICE(storageService));
++ mwService_free(MW_SERVICE(resolveService));
++ mwService_free(MW_SERVICE(imService));
++ mwService_free(MW_SERVICE(awareService));
++ mwCipher_free(mwSession_getCipher(session, mwCipher_RC2_40));
++
++ mwSession_free(session);
++
++ if (socket)
++ delete socket;
++}
++
++/* external interface called by meanwhileaccount */
++void MeanwhileSession::connect(QString host, int port,
++ QString account, QString password)
++{
++ HERE;
++
++ KExtendedSocket *sock = new KExtendedSocket(host, port,
++ KExtendedSocket::bufferedSocket);
++
++ if (sock->connect()) {
++ KMessageBox::queuedMessageBox(0, KMessageBox::Error,
++ i18n( "Could not connect to server"), i18n("Meanwhile Plugin"),
++ KMessageBox::Notify);
++ delete sock;
++ return;
++ }
++ socket = sock;
++ /* we want to receive signals when there is data to read */
++ sock->enableRead(true);
++ QObject::connect(sock, SIGNAL(readyRead()), this,
++ SLOT(slotSocketDataAvailable()));
++ QObject::connect(sock, SIGNAL(closed(int)), this,
++ SLOT(slotSocketClosed(int)));
++
++ mwSession_setProperty(session, mwSession_AUTH_USER_ID,
++ g_strdup(account.ascii()), g_free);
++ mwSession_setProperty(session, mwSession_AUTH_PASSWORD,
++ g_strdup(password.ascii()), g_free);
++
++ /* go!! */
++ mwSession_start(session);
++}
++
++void MeanwhileSession::disconnect()
++{
++ HERE;
++ if (state == mwSession_STOPPED || state == mwSession_STOPPING)
++ return;
++
++ mwSession_stop(session, ERR_SUCCESS);
++}
++
++bool MeanwhileSession::isConnected()
++{
++ return mwSession_isStarted(session);
++}
++
++bool MeanwhileSession::isConnecting()
++{
++ return mwSession_isStarting(session);
++}
++
++static void free_id_block(void *data, void *p)
++{
++ if (p != 0L || data == 0L)
++ return;
++ struct mwAwareIdBlock *id = (struct mwAwareIdBlock *)data;
++ free(id->user);
++ free(id);
++}
++
++void MeanwhileSession::addContacts(const QDict<Kopete::Contact>& contacts)
++{
++ HERE;
++ QDictIterator<Kopete::Contact> it(contacts);
++ GList *buddies = 0L;
++
++ /** Convert our QDict of kopete contact to a GList of meanwhile buddies */
++ for( ; it.current(); ++it) {
++ MeanwhileContact *contact =
++ static_cast<MeanwhileContact *>(it.current());
++ struct mwAwareIdBlock *id = (struct mwAwareIdBlock *)
++ malloc(sizeof(*id));
++ if (id == 0L)
++ continue;
++ id->user = strdup(contact->meanwhileId().ascii());
++ id->community = 0L;
++ id->type = mwAware_USER;
++ buddies = g_list_append(buddies, id);
++ }
++
++ mwAwareList_addAware(awareList, buddies);
++
++ g_list_foreach(buddies, free_id_block, 0L);
++ g_list_free(buddies);
++}
++
++/* private functions used only by the meanwhile session object */
++void MeanwhileSession::addContact(const Kopete::Contact *contact)
++{
++ HERE;
++ struct mwAwareIdBlock id = { mwAware_USER,
++ strdup(static_cast<const MeanwhileContact *>(contact)
++ ->meanwhileId().ascii()),
++ 0L };
++
++ GList *buddies = g_list_prepend(0L, &id);
++ mwAwareList_addAware(awareList, buddies);
++ g_list_free(buddies);
++ free(id.user);
++}
++
++int MeanwhileSession::sendMessage(Kopete::Message &message)
++{
++ HERE;
++ MeanwhileContact *contact =
++ static_cast<MeanwhileContact *>(message.to().first());
++ if (!contact) {
++ mwDebug() << "No target for message!" <<endl;
++ return 0;
++ }
++
++ struct mwIdBlock target = { strdup(contact->meanwhileId().ascii()), 0L };
++ struct mwConversation *conv;
++
++ conv = mwServiceIm_getConversation(imService, &target);
++ free(target.user);
++ if (conv == 0L) {
++ mwDebug() << "No target for conversation with '"
++ << contact->meanwhileId() << "'" << endl;
++ return 0;
++ }
++
++ struct ConversationData *convdata = (struct ConversationData *)
++ mwConversation_getClientData(conv);
++
++ if (convdata == 0L) {
++ convdata = createConversationData(conv, contact, true);
++ if (convdata == 0L) {
++ mwDebug() << "No memory for conversation data!" << endl;
++ return 0;
++ }
++ }
++
++ /* if there's other messages in the queue, or the conversation isn't open,
++ * then append to the queue instead of sending right away */
++ if ((convdata->queue && !convdata->queue->isEmpty()) ||
++ !mwConversation_isOpen(conv)) {
++ convdata->queue->append(message);
++ mwConversation_open(conv);
++
++ } else if (!mwConversation_send(conv, mwImSend_PLAIN,
++ message.plainBody().ascii())) {
++ convdata->chat->appendMessage(message);
++ convdata->chat->messageSucceeded();
++ }
++ return 1;
++}
++
++void MeanwhileSession::sendTyping(MeanwhileContact *contact, bool isTyping)
++{
++ HERE;
++ struct mwIdBlock target = { strdup(contact->meanwhileId().ascii()), 0L };
++ struct mwConversation *conv;
++
++ conv = mwServiceIm_getConversation(imService, &target);
++ free(target.user);
++ if (conv == 0L)
++ return;
++
++ if (mwConversation_isOpen(conv))
++ mwConversation_send(conv, mwImSend_TYPING, (void *)isTyping);
++}
++
++void MeanwhileSession::setStatus(Kopete::OnlineStatus status,
++ const QString msg)
++{
++ HERE;
++ mwDebug() << "setStatus: " << status.description() << "("
++ << status.internalStatus() << ")" << endl;
++ if (status.internalStatus() == 0)
++ return;
++
++ struct mwUserStatus stat;
++ mwUserStatus_clone(&stat, mwSession_getUserStatus(session));
++
++ free(stat.desc);
++
++ stat.status = (mwStatusType)status.internalStatus();
++ if (msg.isNull() || msg.isEmpty())
++ stat.desc = strdup(status.description().ascii());
++ else
++ stat.desc = strdup(msg.ascii());
++
++ mwSession_setUserStatus(session, &stat);
++ /* will free stat.desc */
++ mwUserStatus_clear(&stat);
++}
++
++void MeanwhileSession::syncContactsToServer()
++{
++ HERE;
++ struct mwSametimeList *list = mwSametimeList_new();
++
++ /* set up a fallback group for top-level contacts */
++ struct mwSametimeGroup *topstgroup = mwSametimeGroup_new(list,
++ mwSametimeGroup_DYNAMIC, "People");
++ mwSametimeGroup_setOpen(topstgroup, true);
++
++ QDictIterator<Kopete::Contact> it(account->contacts());
++ for( ; it.current(); ++it ) {
++ MeanwhileContact *contact =
++ static_cast<MeanwhileContact *>(it.current());
++
++ /* Find the group that the metacontact is in */
++ Kopete::MetaContact *mc = contact->metaContact();
++ /* myself doesn't have a metacontact */
++ if (mc == 0L)
++ continue;
++
++ Kopete::Group *contactgroup = mc->groups().getFirst();
++ if (contactgroup == 0L)
++ continue;
++
++ if (contactgroup->type() == Kopete::Group::Temporary)
++ continue;
++
++ struct mwSametimeGroup *stgroup;
++ if (contactgroup->type() == Kopete::Group::TopLevel) {
++ stgroup = topstgroup;
++ } else {
++ /* find (or create) a matching sametime list group */
++ stgroup = mwSametimeList_findGroup(list,
++ contactgroup->displayName().ascii());
++ if (stgroup == 0L) {
++ stgroup = mwSametimeGroup_new(list, mwSametimeGroup_DYNAMIC,
++ contactgroup->displayName().ascii());
++ }
++ mwSametimeGroup_setOpen(stgroup, contactgroup->isExpanded());
++ mwSametimeGroup_setAlias(stgroup,
++ contactgroup->pluginData(account->protocol(), "alias")
++ .ascii());
++ }
++
++ /* now add the user (by IDBlock) */
++ struct mwIdBlock id =
++ { (gchar*)contact->meanwhileId().ascii(), 0L };
++ struct mwSametimeUser *stuser = mwSametimeUser_new(stgroup,
++ mwSametimeUser_NORMAL, &id);
++
++ mwSametimeUser_setAlias(stuser, contact->nickName().ascii());
++ }
++
++ /* store! */
++ struct mwPutBuffer *buf = mwPutBuffer_new();
++ struct mwStorageUnit *unit = mwStorageUnit_new(mwStore_AWARE_LIST);
++ struct mwOpaque *opaque = mwStorageUnit_asOpaque(unit);
++
++ mwSametimeList_put(buf, list);
++ mwPutBuffer_finalize(opaque, buf);
++
++ mwServiceStorage_save(storageService, unit, NULL, NULL, NULL);
++
++ mwSametimeList_free(list);
++}
++
++void MeanwhileSession::syncContactsFromServer()
++{
++ struct mwStorageUnit *unit = mwStorageUnit_new(mwStore_AWARE_LIST);
++ mwServiceStorage_load(storageService, unit, &_handleStorageLoad, 0L, 0L);
++}
++
++#define MEANWHILE_SESSION_BUFSIZ 4096
++
++void MeanwhileSession::slotSocketDataAvailable()
++{
++ HERE;
++ guchar *buf;
++ Q_LONG bytesRead;
++
++ if (socket == 0L)
++ return;
++
++ if (!(buf = (guchar *)malloc(MEANWHILE_SESSION_BUFSIZ))) {
++ mwDebug() << "buffer malloc failed" << endl;
++ return;
++ }
++
++ while (socket && socket->bytesAvailable() > 0) {
++ bytesRead = socket->readBlock((char *)buf, MEANWHILE_SESSION_BUFSIZ);
++ if (bytesRead < 0)
++ break;
++ mwSession_recv(session, buf, (unsigned int)bytesRead);
++ }
++ free(buf);
++}
++
++void MeanwhileSession::slotSocketClosed(int reason)
++{
++ HERE;
++
++ if (reason & KExtendedSocket::involuntary)
++ emit serverNotification(
++ QString("Lost connection with Meanwhile server"));
++
++ if (socket) {
++ delete socket;
++ socket = 0L;
++ }
++
++ mwSession_stop(session, 0x00);
++}
++
++
++Kopete::OnlineStatus MeanwhileSession::convertStatus(int mstatus)
++{
++ MeanwhileProtocol *protocol =
++ static_cast<MeanwhileProtocol *>(account->protocol());
++
++ switch (mstatus) {
++ case mwStatus_ACTIVE:
++ return protocol->statusOnline;
++ break;
++ case mwStatus_IDLE:
++ return protocol->statusIdle;
++ break;
++ case mwStatus_AWAY:
++ return protocol->statusAway;
++ break;
++ case mwStatus_BUSY:
++ return protocol->statusBusy;
++ break;
++ case 0:
++ return protocol->statusOffline;
++ break;
++ default:
++ mwDebug() << "unknown status lookup: " << mstatus << endl;
++ }
++ return protocol->statusOffline;
++}
++
++void MeanwhileSession::resolveContactNickname(MeanwhileContact *contact)
++{
++ /* @todo: FIXME: leak! */
++ char *id = strdup(contact->meanwhileId().ascii());
++ GList *query = g_list_prepend(NULL, id);
++ mwServiceResolve_resolve(resolveService, query, mwResolveFlag_USERS,
++ _handleResolveLookupResults, contact, NULL);
++}
++
++QString MeanwhileSession::getNickName(struct mwLoginInfo *logininfo)
++{
++ if (logininfo == 0L || logininfo->user_name == 0L)
++ return QString::null;
++ return getNickName(logininfo->user_name);
++}
++
++QString MeanwhileSession::getNickName(QString name)
++{
++
++ int index = name.find(" - ");
++ if (index != -1)
++ name = name.remove(0, index + 3);
++ index = name.find('/');
++ if (index != -1)
++ name = name.left(index);
++
++ return name;
++}
++
++MeanwhileContact *MeanwhileSession::conversationContact(
++ struct mwConversation *conv)
++{
++ struct mwIdBlock *target = mwConversation_getTarget(conv);
++ if (target == 0L || target->user == 0L) {
++ return 0L;
++ }
++ QString user(target->user);
++
++ MeanwhileContact *contact =
++ static_cast<MeanwhileContact *>(account->contacts()[user]);
++
++ struct mwLoginInfo *logininfo = mwConversation_getTargetInfo(conv);
++ QString name = getNickName(logininfo);
++
++ if (!contact) {
++ account->addContact(user, name, 0L, Kopete::Account::Temporary);
++ contact = static_cast<MeanwhileContact *>(account->contacts()[user]);
++ } else
++ contact->setNickName(name);
++
++ return contact;
++}
++
++/* priave session handling functions, called by libmeanwhile callbacks */
++void MeanwhileSession::handleSessionStateChange(
++ enum mwSessionState state, gpointer data)
++{
++ HERE;
++ this->state = state;
++
++ switch (state) {
++ case mwSession_STARTING:
++ case mwSession_HANDSHAKE:
++ case mwSession_HANDSHAKE_ACK:
++ case mwSession_LOGIN:
++ case mwSession_LOGIN_REDIR:
++ case mwSession_LOGIN_CONT:
++ case mwSession_LOGIN_ACK:
++ break;
++
++ case mwSession_STARTED:
++ {
++ struct mwUserStatus stat = { mwStatus_ACTIVE, 0, 0L };
++ mwSession_setUserStatus(session, &stat);
++ struct mwLoginInfo *logininfo = mwSession_getLoginInfo(session);
++ if (logininfo) {
++ account->myself()->setNickName(getNickName(logininfo));
++ }
++ syncContactsFromServer();
++ }
++ break;
++
++ case mwSession_STOPPING:
++ {
++ unsigned int info = GPOINTER_TO_UINT(data);
++ if (info & ERR_FAILURE) {
++ if (info == INCORRECT_LOGIN)
++ account->password().setWrong();
++ char *reason = mwError(info);
++ emit serverNotification(QString(reason));
++ free(reason);
++ }
++ }
++
++ emit sessionStateChange(
++ static_cast<MeanwhileProtocol *>(account->protocol())
++ ->statusOffline);
++ break;
++
++ case mwSession_STOPPED:
++ break;
++
++ case mwSession_UNKNOWN:
++ default:
++ mwDebug() << "Unhandled state change " << state << endl;
++ }
++}
++
++int MeanwhileSession::handleSessionIOWrite(const guchar *buffer,
++ unsigned int count)
++{
++ HERE;
++
++ if (socket == 0L)
++ return 1;
++
++ int remaining, retval = 0;
++ for (remaining = count; remaining > 0; remaining -= retval) {
++ retval = socket->writeBlock((char *)buffer, count);
++ if (retval <= 0)
++ return 1;
++ }
++ socket->flush();
++ return 0;
++}
++
++void MeanwhileSession::handleSessionAdmin(const char *text)
++{
++ HERE;
++ emit serverNotification(QString(text));
++}
++
++void MeanwhileSession::handleSessionAnnounce(struct mwLoginInfo *from,
++ gboolean /* may_reply */, const char *text)
++{
++ HERE;
++ QString message;
++ message.sprintf("Announcement from %s:\n%s", from->user_id, text);
++ emit serverNotification(message);
++}
++
++void MeanwhileSession::handleSessionSetUserStatus()
++{
++ struct mwUserStatus *userstatus = mwSession_getUserStatus(session);
++ emit sessionStateChange(convertStatus((unsigned int)userstatus->status));
++}
++
++void MeanwhileSession::handleSessionSetPrivacyInfo()
++{
++}
++
++void MeanwhileSession::handleSessionIOClose()
++{
++ HERE;
++
++ if (socket == 0L)
++ return;
++
++ QObject::disconnect(socket, SIGNAL(closed(int)),
++ this, SLOT(slotSocketClosed(int)));
++ socket->flush();
++ socket->closeNow();
++
++ delete socket;
++ socket = 0L;
++}
++
++void MeanwhileSession::handleSessionClear()
++{
++}
++
++void MeanwhileSession::handleAwareAttrib(struct mwAwareAttribute * /* attrib */)
++{
++ HERE;
++}
++
++void MeanwhileSession::handleAwareListAware(struct mwAwareSnapshot *snapshot)
++{
++ HERE;
++ MeanwhileContact *contact = static_cast<MeanwhileContact *>
++ (account->contacts()[snapshot->id.user]);
++
++ if (contact == 0L)
++ return;
++
++ /* use the setUserStatus callback for status updates for myself. */
++ if (contact == account->myself())
++ return;
++
++ contact->setProperty(get_protocol()->statusMessage, snapshot->status.desc);
++ contact->setProperty(get_protocol()->awayMessage, snapshot->status.desc);
++
++ Kopete::OnlineStatus onlinestatus;
++ if (snapshot->online) {
++ onlinestatus = convertStatus(snapshot->status.status);
++ resolveContactNickname(contact);
++ } else {
++ onlinestatus = convertStatus(0);
++ }
++
++ contact->setOnlineStatus(onlinestatus);
++
++#if 0
++ /* Commented out in previous kopete/meanwhile plugin for some reason,
++ * but has still been ported to the new API.
++ */
++ time_t idletime = 0;
++ if (snapshot->status.status == mwStatus_IDLE) {
++ idletime = (snapshot->status.time == 0xdeadbeef) ?
++ 0 : snapshot->status.time;
++ if (idletime != 0) {
++ contact->setStatusDescription(statusDesc + "[" +
++ QString::number(idletime/60)+" mins]");
++ }
++ } else
++ contact->setStatusDescription(snapshot->status.desc);
++#endif
++}
++
++void MeanwhileSession::handleAwareListAttrib(struct mwAwareIdBlock * /* id */,
++ struct mwAwareAttribute * /* attrib */)
++{
++ HERE;
++}
++
++struct MeanwhileSession::ConversationData
++ *MeanwhileSession::createConversationData(
++ struct mwConversation *conv, MeanwhileContact *contact,
++ bool createQueue)
++{
++ struct ConversationData *cd = new ConversationData();
++
++ if (cd == 0L)
++ return 0L;
++
++ cd->contact = contact;
++ cd->chat = contact->manager(Kopete::Contact::CanCreate);
++ cd->chat->ref();
++ if (createQueue)
++ cd->queue = new QValueList<Kopete::Message>();
++
++ mwConversation_setClientData(conv, cd, 0L);
++
++ return cd;
++}
++
++void MeanwhileSession::handleImConvOpened(struct mwConversation *conv)
++{
++ HERE;
++
++ struct ConversationData *convdata =
++ (struct ConversationData *)mwConversation_getClientData(conv);
++
++ if (convdata == 0L) {
++ /* a new conversation */
++ convdata = createConversationData(conv, conversationContact(conv));
++
++ if (convdata == 0L) {
++ mwDebug() << "No memory for conversation data!" << endl;
++ return;
++ }
++
++ } else if (convdata->queue && !convdata->queue->isEmpty()) {
++ /* send any messages that were waiting for the conversation to open */
++ QValueList<Kopete::Message>::iterator it;
++ for (it = convdata->queue->begin(); it != convdata->queue->end();
++ ++it) {
++ mwConversation_send(conv, mwImSend_PLAIN,
++ (*it).plainBody().ascii());
++ convdata->chat->appendMessage(*it);
++ convdata->chat->messageSucceeded();
++ }
++ convdata->queue->clear();
++ delete convdata->queue;
++ convdata->queue = 0L;
++ }
++ resolveContactNickname(convdata->contact);
++}
++
++void MeanwhileSession::handleImConvClosed(struct mwConversation *conv,
++ guint32)
++{
++ HERE;
++
++ ConversationData *convdata =
++ (ConversationData *)mwConversation_getClientData(conv);
++
++ if (!convdata)
++ return;
++
++ mwConversation_setClientData(conv, 0L, 0L);
++
++ convdata->chat->removeContact(convdata->contact);
++ convdata->chat->deref();
++ convdata->chat = 0L;
++ if (convdata->queue != 0L) {
++ convdata->queue->clear();
++ delete convdata->queue;
++ convdata->queue = 0L;
++ }
++ free(convdata);
++}
++
++void MeanwhileSession::handleImConvReceived(struct mwConversation *conv,
++ enum mwImSendType type, gconstpointer msg)
++{
++ HERE;
++ ConversationData *convdata =
++ (ConversationData *)mwConversation_getClientData(conv);
++
++ if (!convdata)
++ return;
++
++ switch (type) {
++ case mwImSend_PLAIN:
++ {
++ Kopete::Message message(convdata->contact, account->myself(),
++ QString((char *)msg), Kopete::Message::Inbound);
++ convdata->chat->appendMessage(message);
++ }
++ break;
++ case mwImSend_TYPING:
++ convdata->chat->receivedTypingMsg(convdata->contact);
++ break;
++ default:
++ mwDebug() << "Unable to handle message type: " << type << endl;
++ }
++}
++
++void MeanwhileSession::handleResolveLookupResults(
++ struct mwServiceResolve * /* srvc */, guint32 /* id */,
++ guint32 /* code */, GList *results, gpointer data)
++{
++ struct mwResolveResult *result;
++ struct mwResolveMatch *match;
++
++ if (results == 0L)
++ return;
++ if ((result = (struct mwResolveResult *)results->data) == 0L)
++ return;
++
++ if (result->matches == 0L)
++ return;
++ if ((match = (struct mwResolveMatch *)result->matches->data) == 0L)
++ return;
++
++ mwDebug() << "resolve lookup returned '" << match->name << "'" << endl;
++
++ MeanwhileContact *contact = (MeanwhileContact *)data;
++ if (contact == 0L)
++ return;
++
++ contact->setNickName(getNickName(match->name));
++}
++
++void MeanwhileSession::handleStorageLoad(struct mwServiceStorage * /* srvc */,
++ guint32 result, struct mwStorageUnit *item, gpointer /* data */)
++{
++ HERE;
++ if (result != ERR_SUCCESS) {
++ mwDebug() << "contact list load returned " << result << endl;
++ return;
++ }
++
++ struct mwGetBuffer *buf = mwGetBuffer_wrap(mwStorageUnit_asOpaque(item));
++ struct mwSametimeList *list = mwSametimeList_new();
++ mwSametimeList_get(buf, list);
++
++ GList *gl, *glf, *cl, *clf;
++
++ Kopete::ContactList *contactlist = Kopete::ContactList::self();
++
++ for (glf = gl = mwSametimeList_getGroups(list); gl; gl = gl->next) {
++ struct mwSametimeGroup *stgroup = (struct mwSametimeGroup *)gl->data;
++
++ Kopete::Group *group =
++ contactlist->findGroup(mwSametimeGroup_getName(stgroup));
++ group->setPluginData(account->protocol(), "alias",
++ mwSametimeGroup_getAlias(stgroup));
++
++ for (clf = cl = mwSametimeGroup_getUsers(stgroup); cl; cl = cl->next) {
++ struct mwSametimeUser *stuser = (struct mwSametimeUser *)cl->data;
++
++ MeanwhileContact *contact = static_cast<MeanwhileContact *>
++ (account->contacts()[mwSametimeUser_getUser(stuser)]);
++
++ if (contact != 0L)
++ continue;
++
++ account->addContact(mwSametimeUser_getUser(stuser),
++ mwSametimeUser_getAlias(stuser), group,
++ Kopete::Account::ChangeKABC);
++ }
++ g_list_free(clf);
++ }
++ g_list_free(glf);
++
++ mwSametimeList_free(list);
++}
++
++#if 0
++MEANWHILE_HOOK_CONFERENCE(conference_invite,
++ (struct mwConference *conf, struct mwLoginInfo *inviter,
++ const char *invite),
++ (conf, inviter, invite))
++{
++ HERE;
++ QString message;
++
++ message.sprintf("%s has invited you to a conference called \"%s\"\n"
++ "However, this version of the meanwhile plugin does "
++ "not support conferences, so the invitiation has been declined.",
++ inviter->user_id, invite);
++
++ mwConference_reject(conf, ERR_SUCCESS,
++ "Sorry, my client doesn't support conferences!");
++ KMessageBox::queuedMessageBox(0, KMessageBox::Sorry , message,
++ i18n("Meanwhile Plugin: Conference invitation"),
++ KMessageBox::Notify);
++}
++#endif
++#include "meanwhilesession.moc"
+--- kde.orig/kopete/protocols/meanwhile/meanwhilesession.h
++++ kde.patched/kopete/protocols/meanwhile/meanwhilesession.h
+@@ -0,0 +1,341 @@
++/*
++ meanwhilesession.h - interface to the 'C' meanwhile session
++
++ Copyright (c) 2005 by Jeremy Kerr <jk at ozlabs.org>
++
++ *************************************************************************
++ * *
++ * 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 MEANWHILESESSION_H
++#define MEANWHILESESSION_H
++
++#include "meanwhileaccount.h"
++#include "meanwhilecontact.h"
++#include <kextendedsocket.h>
++
++#include <mw_session.h>
++#include <mw_service.h>
++#include <mw_srvc_aware.h>
++#include <mw_srvc_im.h>
++#include <mw_srvc_resolve.h>
++
++/**
++ * A class to handle libmeanwhile session management.
++ */
++class MeanwhileSession : public QObject
++{
++ Q_OBJECT
++
++public:
++ /**
++ * Create a session. By default, the session is not connected - you will
++ * need to call login() to initiate the connection process.
++ * @param account The account that the connection is for
++ */
++ MeanwhileSession(MeanwhileAccount *account);
++
++ /**
++ * Destroy the session
++ */
++ ~MeanwhileSession();
++
++ /**
++ * Connect to the server. This will open a socket and start login. Note that
++ * the connection process is ascychronous - a loginDone() signal will be
++ * emitted when sucessfully logged in.
++ */
++ void connect(QString host, int port, QString account, QString password);
++
++ /**
++ * Disconnect from the server.
++ */
++ void disconnect();
++
++ /**
++ * Set our (the local contact's) online status. The internalStatus of the
++ * state argument will be used to define the state message we send - it
++ * should be one of the Status enum fields (and not Offline)
++ * @param state the new state of the local user
++ * @param msg a custom message to use, if required
++ */
++ void setStatus(Kopete::OnlineStatus status,
++ const QString msg = QString::null);
++
++ /**
++ * Add a single contact to be registered for status updates
++ * @param contact The contact to register
++ */
++ void addContact(const Kopete::Contact *contact);
++
++ /**
++ * Add a list of contacts to be registered for status updates
++ * @param contact The list of contacts to register
++ */
++ void addContacts(const QDict<Kopete::Contact>& contacts);
++
++ /**
++ * Send a message (with recipient specified).
++ * @param message The message to send
++ * @return non-zero if the message could be sent
++ */
++ int sendMessage(Kopete::Message &message);
++
++ /**
++ * Send a typing notification to a contact
++ * @param contact The contact to notify
++ * @param isTyping If true, the typing notification is set
++ */
++ void sendTyping(MeanwhileContact *contact, bool isTyping);
++
++ /**
++ * Determine if the session is connected to the server
++ * @return true if the session is connected
++ */
++ bool isConnected();
++
++ /**
++ * Determine if the session is in the process of connecting to the server
++ * @return true if the session is connecting
++ */
++ bool isConnecting();
++
++signals:
++ /**
++ * Emitted when the status of the connection changes
++ * @param status The new status of the session
++ */
++ void sessionStateChange(Kopete::OnlineStatus status);
++
++ /**
++ * Emitted when a notification is received from the server, or other
++ * out-of-band data (eg, the password is incorrect).
++ * @param mesgString A description of the notification
++ */
++ void serverNotification(const QString &mesgString);
++
++private:
++ /** Main libmeanwhile session object */
++ struct mwSession *session;
++
++ /** Session handler */
++ struct mwSessionHandler sessionHandler;
++
++ /** Aware service */
++ struct mwServiceAware *awareService;
++
++ /** Aware handler */
++ struct mwAwareHandler awareHandler;
++
++ /** Aware List Handler */
++ struct mwAwareListHandler awareListHandler;
++
++ /** The aware list */
++ struct mwAwareList *awareList;
++
++ /** Aware service */
++ struct mwServiceIm *imService;
++
++ /** Aware handler */
++ struct mwImHandler imHandler;
++
++ /** Resolve service */
++ struct mwServiceResolve *resolveService;
++
++ /** Storage service, for contact list */
++ struct mwServiceStorage *storageService;
++
++ /** Last recorded meanwhile state */
++ enum mwSessionState state;
++
++ /** The kopete account that this library is for */
++ MeanwhileAccount *account;
++
++ /** socket to the server */
++ KExtendedSocket *socket;
++
++ /* These structures are stored in the libmeanwhile 'ClientData' fields */
++
++ /** Stored in the mwConversation struct */
++ struct ConversationData {
++ MeanwhileContact *contact;
++ Kopete::ChatSession *chat;
++ QValueList<Kopete::Message> *queue;
++ };
++
++ /** (To be) stored in the mwConference struct */
++ struct ConferenceData {
++ Kopete::ChatSession *chatsession;
++ };
++
++ /**
++ * Initialise the conversation data struct for a conversation, and store it
++ * in the meanwhile conversation object
++ * @param conv the meanwhile conversation object
++ * @param contact the contact that the conversation is with
++ * @param createQueue whether a message queue is required for this
++ * conversation
++ * @return The created conversation data struct
++ */
++ struct ConversationData *MeanwhileSession::createConversationData(
++ struct mwConversation *conv, MeanwhileContact *contact,
++ bool createQueue = false);
++
++ /**
++ * Get the contact for a conversation
++ * @param conv the meanwhile conversation
++ * @return the contact that this conversation is held with
++ */
++ MeanwhileContact *conversationContact(struct mwConversation *conv);
++
++ /**
++ * Convert a libmeanwhile-type status into one of the MeanwhileProtocol
++ * statuses
++ * @param mstatus The internal status to convert
++ * @return The Meanwhile status
++ */
++ Kopete::OnlineStatus convertStatus(int mstatus);
++
++ /**
++ * Parse the nickname of a libmeanwhile contact. From what I've seen,
++ * usernames are in the format:
++ * <userid> - <name>/<domain>/<domain>
++ * @param name the extened username to parse
++ * @return just the name part of the username info
++ */
++ QString getNickName(QString name);
++
++ /**
++ * Convenience method to call the above from a mwLoginInfo struct. All is
++ * checked for null.
++ * @param logininfo the login info for a contact
++ * @return just the name part of the login info data
++ */
++ QString getNickName(struct mwLoginInfo *logininfo);
++
++ /**
++ * Resolve a contact to find (and set) the display name. This requires the
++ * session to be connected to use the meanwhile resolve service.
++ * @param contact The contact to resolve
++ */
++ void resolveContactNickname(MeanwhileContact *contact);
++
++public:
++ void syncContactsToServer();
++ void syncContactsFromServer();
++
++private slots:
++
++ /** Notify the library that data is available on the socket */
++ void slotSocketDataAvailable();
++
++ /**
++ * Notify the library that the socket has been closed
++ * @param reason the reason for closing
++ */
++ void slotSocketClosed(int reason);
++
++private:
++ /* ugly callbacks for libmeanwhile interface. These declare a static method
++ * to proxy the callback from libmeanwhile to a call to the MeanwhileSession
++ */
++
++#define declare_session_handler_type(type, func, args, ...) \
++ static type _handleSession ## func ( \
++ struct mwSession *mwsession, __VA_ARGS__) { \
++ MeanwhileSession *session = \
++ (MeanwhileSession *)mwSession_getClientData(mwsession); \
++ return session->handleSession ## func args; \
++ }; \
++ type handleSession ## func(__VA_ARGS__)
++#define declare_session_handler(func, args, ...) \
++ static void _handleSession ## func ( \
++ struct mwSession *mwsession, ## __VA_ARGS__) { \
++ MeanwhileSession *session = \
++ (MeanwhileSession *)mwSession_getClientData(mwsession); \
++ session->handleSession ## func args; \
++ }; \
++ void handleSession ## func(__VA_ARGS__)
++
++ declare_session_handler_type(int, IOWrite, (buf, len),
++ const guchar *buf, gsize len);
++ declare_session_handler(IOClose,());
++ declare_session_handler(Clear,());
++ declare_session_handler(StateChange, (state, info),
++ enum mwSessionState state, gpointer info);
++ declare_session_handler(SetPrivacyInfo,());
++ declare_session_handler(SetUserStatus,());
++ declare_session_handler(Admin, (text), const char *text);
++ declare_session_handler(Announce, (from, may_reply, text),
++ struct mwLoginInfo *from, gboolean may_reply, const char *text);
++
++#define declare_aware_handler(func, args, ...) \
++ static void _handleAware ## func ( \
++ struct mwServiceAware *srvc, ## __VA_ARGS__) { \
++ MeanwhileSession *session = (MeanwhileSession *) \
++ mwService_getClientData((struct mwService *)srvc); \
++ return session->handleAware ## func args; \
++ }; \
++ void handleAware ## func(__VA_ARGS__)
++
++ declare_aware_handler(Attrib, (attrib), struct mwAwareAttribute *attrib);
++ declare_aware_handler(Clear,());
++
++#define declare_aware_list_handler(func, args, ...) \
++ static void _handleAwareList ## func ( \
++ struct mwAwareList *list, ## __VA_ARGS__){ \
++ MeanwhileSession *session = (MeanwhileSession *) \
++ mwAwareList_getClientData(list); \
++ return session->handleAwareList ## func args; \
++ }; \
++ void handleAwareList ## func(__VA_ARGS__)
++
++ declare_aware_list_handler(Aware, (snapshot),
++ struct mwAwareSnapshot *snapshot);
++ declare_aware_list_handler(Attrib, (id, attrib),
++ struct mwAwareIdBlock *id, struct mwAwareAttribute *attrib);
++ declare_aware_list_handler(Clear,());
++
++#define declare_im_handler(func, args, ...) \
++ static void _handleIm ## func ( \
++ struct mwConversation *conv, ## __VA_ARGS__) { \
++ MeanwhileSession *session = (MeanwhileSession *) \
++ mwService_getClientData( \
++ (struct mwService *)mwConversation_getService(conv)); \
++ return session->handleIm ## func args; \
++ }; \
++ void handleIm ## func (struct mwConversation *conv, ## __VA_ARGS__)
++
++ declare_im_handler(ConvOpened, (conv));
++ declare_im_handler(ConvClosed, (conv, err), guint32 err);
++ declare_im_handler(ConvReceived, (conv, type, msg),
++ enum mwImSendType type, gconstpointer msg);
++
++ /* resolve service */
++ static void _handleResolveLookupResults(struct mwServiceResolve *srvc,
++ guint32 id, guint32 code, GList *results, gpointer data) {
++ MeanwhileSession *session = (MeanwhileSession *)
++ mwService_getClientData(MW_SERVICE(srvc));
++ session->handleResolveLookupResults(srvc, id, code, results, data);
++ };
++ void handleResolveLookupResults(struct mwServiceResolve *srvc, guint32 id,
++ guint32 code, GList *results, gpointer data);
++
++ /* storage service */
++ static void _handleStorageLoad(struct mwServiceStorage *srvc,
++ guint32 result, struct mwStorageUnit *item, gpointer data) {
++ MeanwhileSession *session = (MeanwhileSession *)
++ mwService_getClientData(MW_SERVICE(srvc));
++ session->handleStorageLoad(srvc, result, item, data);
++ };
++ void handleStorageLoad(struct mwServiceStorage *srvc,
++ guint32 result, struct mwStorageUnit *item, gpointer data);
++};
++
++#endif
++
+--- kde.orig/kopete/protocols/meanwhile/ui/meanwhileeditaccountbase.ui
++++ kde.patched/kopete/protocols/meanwhile/ui/meanwhileeditaccountbase.ui
+@@ -107,31 +107,6 @@
+ </widget>
+ </vbox>
+ </widget>
+- <widget class="QLabel">
+- <property name="name">
+- <cstring>textLabel14</cstring>
+- </property>
+- <property name="sizePolicy">
+- <sizepolicy>
+- <hsizetype>3</hsizetype>
+- <vsizetype>3</vsizetype>
+- <horstretch>0</horstretch>
+- <verstretch>0</verstretch>
+- </sizepolicy>
+- </property>
+- <property name="minimumSize">
+- <size>
+- <width>600</width>
+- <height>0</height>
+- </size>
+- </property>
+- <property name="text">
+- <string><i>contact suppandi at gmail.com if you have any problems.</i></string>
+- </property>
+- <property name="alignment">
+- <set>WordBreak|AlignTop</set>
+- </property>
+- </widget>
+ </vbox>
+ </widget>
+ <widget class="QWidget">
+--- kde.orig/kopete/protocols/configure.in.in
++++ kde.patched/kopete/protocols/configure.in.in
+@@ -179,55 +179,44 @@
+ AC_SUBST(IDN_CPPFLAGS)
+ AC_SUBST(IDN_LIBS)
+
+-
+-#
+ # Sametime support
+-#
+
+ # lower and upper-bound versions of Meanwhile library
+-m4_define(meanwhile_version_min, 0.4.2)
+-m4_define(meanwhile_version_max, 0.5.0)
++m4_define(libmeanwhile_version_min, 1.0.1)
++m4_define(libmeanwhile_version_max, 1.1.0)
+
+ # Let the user disable the plugin
+-AC_ARG_ENABLE(sametime-plugin,
+- AC_HELP_STRING([--enable-sametime-plugin], [build the Kopete Sametime plugin @<:@default=no@:>@]),
+- [compile_meanwhile=$enableval],
+- [compile_meanwhile=no]
++AC_ARG_ENABLE(meanwhile,
++ AC_HELP_STRING([--disable-meanwhile],
++ [disable the Kopete Meanwhile plugin (Lotus Sametime support) @<:@default=enabled@:>@]),
+ )
+
+-# Check and setup for Meanwhile library
+-KDE_PKG_CHECK_MODULES(MEANWHILE,
+- [meanwhile >= meanwhile_version_min meanwhile < meanwhile_version_max],
+- [have_meanwhile=yes],
+- [have_meanwhile=no]
+- )
++if test "x$enable_meanwhile" != "xno"; then
++ # Check and setup for libmeanwhile
++ KDE_PKG_CHECK_MODULES(MEANWHILE,
++ [meanwhile >= libmeanwhile_version_min meanwhile < libmeanwhile_version_max],
++ [have_libmeanwhile=yes], [have_libmeanwhile=no])
++
++ if test "x$have_libmeanwhile" = "xno"; then
++ enable_meanwhile=no
++ AC_MSG_RESULT([not found])
++ else
++ AC_MSG_RESULT([found])
++ fi
++fi
++
+ AC_SUBST(MEANWHILE_CFLAGS)
+ AC_SUBST(MEANWHILE_LIBS)
+
+-# Check and setup for GLib library
+-KDE_PKG_CHECK_MODULES(GLIB,
+- [glib-2.0 >= 2.0.0],
+- [have_glib=yes],
+- [have_glib=no]
+- )
+-AC_SUBST(GLIB_CFLAGS)
+-AC_SUBST(GLIB_LIBS)
+-
+-# Do we everything we need to compile the plugin
+-if test "x$have_meanwhile" != "xyes" || test "x$have_glib" != "xyes"; then
+- compile_meanwhile=no
++AC_MSG_CHECKING([if Meanwhile plugin should be compiled])
++if test "x$enable_meanwhile" != "xno"; then
++ AC_MSG_RESULT([yes])
++else
++ AC_MSG_RESULT([no])
+ fi
+
+-# Let the user know
+-AC_MSG_CHECKING([if Sametime Plugin should be compiled])
+-AC_MSG_RESULT($compile_meanwhile)
+-
+-# Here we go
+-AM_CONDITIONAL(include_meanwhile, [test "x$compile_meanwhile" = "xyes"])
+-
+-#
+-# End of Sametime support
+-#
++# Set the flag to compile meanwhile
++AM_CONDITIONAL(include_meanwhile, [test "x$enable_meanwhile" != "xno"])
+
+ # testbed protocol
+ dnl define the configure option that disables testbed protocol
More information about the pkg-kde-commits
mailing list