[prev in list] [next in list] [prev in thread] [next in thread]
List: kopete-devel
Subject: [kopete-devel] meanwhile protocol updates
From: Jeremy Kerr <jk () ozlabs ! org>
Date: 2008-11-07 4:37:05
Message-ID: 200811071537.05754.jk () ozlabs ! org
[Download RAW message or body]
Hi all,
As I've just moved to a KDE4 on my main machine, it's time to update the
meanwhile protocol a little. Thanks to Harald Fernengel, most of the
heavy-lifting has already been done, but these changes are required to
make things work for me.
The series:
1/5 add-meanwhile-cmake-check.patch
2/5 fix-meanwhile-build.patch
3/5 Add-RC-168-cipher-support-for-meanwhile-connections.patch
4/5 Allow-arbitrary-meanwhile-client-identifiers.patch
5/5 fix-add-dialog.patch
As this is the first KDE4 work I've done, I'd appreciate a quick review
- especially for the cmake side of things, in the first two patches. If
there are no objections, I'm happy to commit.
Cheers,
Jeremy
["add-meanwhile-cmake-check.patch" (text/x-patch)]
protocols/meanwhile: Add CMake check for libmeanwhile
Add a cmake/modules/FindLibMeanwhile cmake check for the libmeanwhile
package, and enable conditional compilation of the meanwhile
protocol (defaults to OFF).
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Index: kdenetwork/cmake/modules/FindLibMeanwhile.cmake
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ kdenetwork/cmake/modules/FindLibMeanwhile.cmake 2008-10-31 23:09:53.000000000 \
+1100 @@ -0,0 +1,44 @@
+# Try to find libmeanwhile package
+#
+# Copyright (c) 2008, Jeremy Kerr <jk@ozlabs.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+IF (NOT WIN32)
+ INCLUDE(UsePkgConfig)
+
+ PKGCONFIG(meanwhile
+ _LibMeanwhileIncDir
+ _LibMeanwhileLinkDir
+ _LibMeanwhileLinkFlags
+ _LibMeanwhileCflags)
+
+ FIND_PATH(LIBMEANWHILE_INCLUDE_DIR meanwhile/mw_common.h
+ PATHS
+ ${_LibMeanwhileIncDir}
+ NO_DEFAULT_PATH
+ )
+
+ set(LIBMEANWHILE_DEFINITIONS ${_LibMeanwhileCflags})
+
+ FIND_LIBRARY(LIBMEANWHILE_LIBRARY NAMES meanwhile libmeanwhile
+ PATHS
+ ${_LibMeanwhileLinkDir}
+ NO_DEFAULT_PATH
+ )
+ELSE (NOT WIN32)
+ FIND_PATH(LIBMEANWHILE_INCLUDE_DIR meanwhile/mw_common.h)
+ FIND_LIBRARY(LIBMEANWHILE_LIBRARY NAMES meanwhile libmeanwhile)
+ENDIF (NOT WIN32)
+
+set(LIBMEANWHILE_INCLUDES ${LIBMEANWHILE_INCLUDE_DIR} )
+
+FIND_PACKAGE(GLIB2)
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(libmeanwhile DEFAULT_MSG
+ LIBMEANWHILE_INCLUDES LIBMEANWHILE_LIBRARY)
+
+MARK_AS_ADVANCED(LIBMEANWHILE_INCLUDE_DIR LIBMEANWHILE_LIBRARY)
+
Index: kdenetwork/kopete/protocols/CMakeLists.txt
===================================================================
--- kdenetwork.orig/kopete/protocols/CMakeLists.txt 2008-10-31 23:07:58.000000000 \
+1100
+++ kdenetwork/kopete/protocols/CMakeLists.txt 2008-10-31 23:09:24.000000000 +1100
@@ -19,6 +19,7 @@ option(WITH_gadu "Enable Kopete Gadu-Gad
option(WITH_jabber "Enable Kopete Jabber protocol" ON)
option(WITH_bonjour "Enable Kopete Bonjour protocol" ON)
option(WITH_irc "Enable Kopete IRC protocol" OFF)
+option(WITH_meanwhile "Enable Kopete meanwhile protocol" ON)
include_directories(${KOPETE_INCLUDES})
@@ -85,4 +86,10 @@ if(WITH_bonjour)
endif(DNSSD_FOUND)
endif(WITH_bonjour)
-message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: Meanwhile protocol has been disabled \
because it is not ported to KDE4 yet.") +if(WITH_meanwhile)
+ if(LIBMEANWHILE_FOUND)
+ add_subdirectory( meanwhile )
+ else(LIBMEANWHILE_FOUND)
+ message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}: Disabled Meanwhile beause \
libmeanwhile was not found") + endif(LIBMEANWHILE_FOUND)
+endif(WITH_meanwhile)
Index: kdenetwork/kopete/CMakeLists.txt
===================================================================
--- kdenetwork.orig/kopete/CMakeLists.txt 2008-10-31 23:07:58.000000000 +1100
+++ kdenetwork/kopete/CMakeLists.txt 2008-10-31 23:09:24.000000000 +1100
@@ -29,6 +29,10 @@ macro_optional_find_package(LibOTR)
macro_bool_to_01(LIBOTR_FOUND HAVE_LIBOTR)
macro_log_feature(LIBOTR_FOUND "libotr" "A library to encrypt messages with \
Off-the-Record encryption" "http://www.cypherpunks.ca/otr" FALSE "3.1.0" "Required \
for the Kopete otr plugin.")
+macro_optional_find_package(LibMeanwhile)
+macro_bool_to_01(LIBMEANWHILE_FOUND HAVE_LIBMEANWHILE)
+macro_log_feature(LIBMEANWHILE_FOUND "libmeanwhile" "A library for protocol support \
for connection to Sametime servers" "http://libmeanwhile.sf.net" FALSE "" "Required \
for the Kopete Meanwhile protocol") +
check_include_files(valgrind/valgrind.h HAVE_VALGRIND_H)
check_include_files(stdint.h HAVE_STDINT_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
["fix-meanwhile-build.patch" (text/x-patch)]
protocols/meanwhile: Update meanwhile build infrastructure
Now what we check for libmeanwhile in the generic cmake modules,
we don't need to re-check in CMakeLists.txt.
Update the includes to suit LIBMEANWHILE_INCLUDE_DIR
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Index: kdenetwork/kopete/protocols/meanwhile/CMakeLists.txt
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/CMakeLists.txt 2008-10-31 23:07:58.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/CMakeLists.txt 2008-10-31 23:10:12.000000000 +1100
@@ -1,16 +1,12 @@
-INCLUDE(UsePkgConfig)
-add_subdirectory( icons )
+add_subdirectory( icons )
-########### next target ###############
+add_definitions(${LIBMEANWHILE_DEFINITIONS})
+include_directories(${LIBMEANWHILE_INCLUDE_DIR})
-kde4_add_ui_files(kopete_meanwhile_ui_SRCS
- ui/meanwhileaddcontact.ui
- ui/meanwhileeditaccount.ui
-)
+########### next target ###############
set(kopete_meanwhile_PART_SRCS
- ${kopete_meanwhile_ui_SRCS}
meanwhileaccount.cpp
meanwhileaddcontactpage.cpp
meanwhileplugin.cpp
@@ -19,31 +15,22 @@ set(kopete_meanwhile_PART_SRCS
meanwhileeditaccountwidget.cpp
meanwhilesession.cpp )
-### TODO - make these real configure checks
-find_package(GLIB2)
-PKGCONFIG(meanwhile _meanwhileIncDir _meanwhileLinkDir _meanwhileLinkFlags _meanwhileCflags)
-
-FIND_LIBRARY(MEANWHILE_LIBRARY NAMES meanwhile
- PATHS
- ${_meanwhileLinkDir}
- NO_DEFAULT_PATH
+kde4_add_ui_files(kopete_meanwhile_PART_SRCS
+ ui/meanwhileaddcontact.ui
+ ui/meanwhileeditaccount.ui
)
-### meanwhile.pc sets the wrong "includedir" variable - need to add meanwhile manually
-#include_directories (${_meanwhileIncDir} ${GLIB2_INCLUDE_DIR})
-include_directories (${_meanwhileIncDir}/meanwhile ${GLIB2_INCLUDE_DIR})
-
kde4_add_plugin(kopete_meanwhile ${kopete_meanwhile_PART_SRCS})
target_link_libraries(kopete_meanwhile
- ${KDE4_KDECORE_LIBS} ${GLIB2_LIBRARIES} ${MEANWHILE_LIBRARY}
+ ${KDE4_KDECORE_LIBS} ${GLIB2_LIBRARIES} ${LIBMEANWHILE_LIBRARY}
kopete)
-install(TARGETS kopete_meanwhile DESTINATION ${PLUGIN_INSTALL_DIR})
+install(TARGETS kopete_meanwhile DESTINATION ${PLUGIN_INSTALL_DIR})
########### install files ###############
-install( FILES kopete_meanwhile.desktop DESTINATION ${SERVICES_INSTALL_DIR})
+install(FILES kopete_meanwhile.desktop DESTINATION ${SERVICES_INSTALL_DIR})
Index: kdenetwork/kopete/protocols/meanwhile/meanwhileprotocol.cpp
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhileprotocol.cpp 2008-10-31 23:07:58.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhileprotocol.cpp 2008-10-31 23:09:59.000000000 +1100
@@ -23,7 +23,7 @@
#include "kopeteglobal.h"
#include "kopeteonlinestatusmanager.h"
-#include "mw_common.h"
+#include <meanwhile/mw_common.h>
K_PLUGIN_FACTORY( MeanwhileProtocolFactory, registerPlugin<MeanwhileProtocol>(); )
K_EXPORT_PLUGIN( MeanwhileProtocolFactory( "kopete_meanwhile" ) )
Index: kdenetwork/kopete/protocols/meanwhile/meanwhilesession.cpp
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhilesession.cpp 2008-10-31 23:07:58.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhilesession.cpp 2008-10-31 23:09:59.000000000 +1100
@@ -29,17 +29,17 @@
#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>
+#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_srvc_store.h>
+#include <meanwhile/mw_cipher.h>
+#include <meanwhile/mw_st_list.h>
//Added by qt3to4:
#include <Q3ValueList>
Index: kdenetwork/kopete/protocols/meanwhile/meanwhilesession.h
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhilesession.h 2008-10-31 23:07:58.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhilesession.h 2008-10-31 23:09:59.000000000 +1100
@@ -18,11 +18,11 @@
#include "meanwhileaccount.h"
#include "meanwhilecontact.h"
-#include <mw_session.h>
-#include <mw_service.h>
-#include <mw_srvc_aware.h>
-#include <mw_srvc_im.h>
-#include <mw_srvc_resolve.h>
+#include <meanwhile/mw_session.h>
+#include <meanwhile/mw_service.h>
+#include <meanwhile/mw_srvc_aware.h>
+#include <meanwhile/mw_srvc_im.h>
+#include <meanwhile/mw_srvc_resolve.h>
//Added by qt3to4:
#include <Q3ValueList>
["Add-RC-168-cipher-support-for-meanwhile-connections.patch" (text/x-patch)]
protocols/meanwhile: Add RC-168 cipher support for meanwhile connections
We need to allow RC-128 for some servers.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhilesession.cpp 2008-10-31 14:41:59.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhilesession.cpp 2008-10-31 15:52:00.000000000 +1100
@@ -118,6 +118,7 @@ MeanwhileSession::MeanwhileSession(Meanw
/* add a necessary cipher */
mwSession_addCipher(session, mwCipher_new_RC2_40(session));
+ mwSession_addCipher(session, mwCipher_new_RC2_128(session));
}
MeanwhileSession::~MeanwhileSession()
@@ -137,6 +138,7 @@ MeanwhileSession::~MeanwhileSession()
mwService_free(MW_SERVICE(imService));
mwService_free(MW_SERVICE(awareService));
mwCipher_free(mwSession_getCipher(session, mwCipher_RC2_40));
+ mwCipher_free(mwSession_getCipher(session, mwCipher_RC2_128));
mwSession_free(session);
}
["Allow-arbitrary-meanwhile-client-identifiers.patch" (text/x-patch)]
protocols/meanwhile: allow user-specified client ID
Some meanwhile servers restrict client access on the client's ID
and version during handshake (like a HTTP User-Agent header..). This
client ID consists of an application ID, and a major and minor version
number.
This change allows meanwhile users to specify their own meanwhile client
ID when connecting to meanwhile servers.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Index: kdenetwork/kopete/protocols/meanwhile/meanwhilesession.cpp
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhilesession.cpp 2008-10-31 \
18:41:51.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhilesession.cpp 2008-10-31 \
18:43:15.000000000 +1100 @@ -51,6 +51,33 @@
#define get_protocol() (static_cast<MeanwhileProtocol *>(account->protocol()))
+static struct MeanwhileClientID ids[] = {
+ { mwLogin_LIB, "Lotus Binary Library" },
+ { mwLogin_JAVA_WEB, "Lotus Java Applet", },
+ { mwLogin_BINARY, "Lotus Binary App", },
+ { mwLogin_JAVA_APP, "Lotus Java App", },
+ { mwLogin_LINKS, "Sametime Links", },
+
+ { mwLogin_NOTES_6_5, "Notes 6.5", },
+ { mwLogin_NOTES_6_5_3, "Notes 6.5.3", },
+ { mwLogin_NOTES_7_0_beta, "Notes 7.0 beta", },
+ { mwLogin_NOTES_7_0, "Notes 7.0", },
+ { mwLogin_ICT, "ICT", },
+ { mwLogin_ICT_1_7_8_2, "ICT 1.7.8.2", },
+ { mwLogin_ICT_SIP, "ICT SIP", },
+ { mwLogin_NOTESBUDDY_4_14, "NotesBuddy 4.14", },
+ { mwLogin_NOTESBUDDY_4_15, "NotesBuddy 4.15" },
+ { mwLogin_NOTESBUDDY_4_16, "NotesBuddy 4.16" },
+ { mwLogin_SANITY, "Sanity", },
+ { mwLogin_ST_PERL, "ST Perl", },
+ { mwLogin_PMR_ALERT, "PMR Alert", },
+ { mwLogin_TRILLIAN, "Trillian", },
+ { mwLogin_TRILLIAN_IBM, "Trillian (IBM)", },
+ { mwLogin_MEANWHILE, "Meanwhile Library", },
+ { 0, NULL },
+};
+
+
MeanwhileSession::MeanwhileSession(MeanwhileAccount *acc)
: session(0), state(mwSession_STOPPED), account(acc), socket(0)
{
@@ -143,12 +170,29 @@ MeanwhileSession::~MeanwhileSession()
mwSession_free(session);
}
+void MeanwhileSession::getDefaultClientIDParams(int *clientID,
+ int *verMajor, int *verMinor)
+{
+ *clientID = mwLogin_MEANWHILE;
+ *verMajor = MW_PROTOCOL_VERSION_MAJOR;
+ *verMinor = MW_PROTOCOL_VERSION_MINOR;
+}
+
/* external interface called by meanwhileaccount */
-void MeanwhileSession::connect(QString host, int port,
- QString account, QString password)
+void MeanwhileSession::connect(QString password)
{
HERE;
+ int port, clientID, versionMajor, versionMinor;
+ bool useCustomID;
+ QString host;
+
+ host = account->getServerName();
+ port = account->getServerPort();
+ useCustomID = account->getClientIDParams(&clientID,
+ &versionMajor, &versionMinor);
+
+
QTcpSocket *sock = new QTcpSocket(this);
sock->connectToHost(host, quint16(port));
@@ -167,11 +211,23 @@ void MeanwhileSession::connect(QString h
QObject::connect(sock, SIGNAL(aboutToClose()), this,
SLOT(slotSocketAboutToClose()));
+ /* set login details */
mwSession_setProperty(session, mwSession_AUTH_USER_ID,
- g_strdup(account.toAscii()), g_free);
+ g_strdup(account->meanwhileId().toAscii()), g_free);
mwSession_setProperty(session, mwSession_AUTH_PASSWORD,
g_strdup(password.toAscii()), g_free);
+ /* set client type parameters */
+ if (useCustomID) {
+ mwSession_setProperty(session, mwSession_CLIENT_TYPE_ID,
+ GUINT_TO_POINTER(clientID), NULL);
+ mwSession_setProperty(session, mwSession_CLIENT_VER_MAJOR,
+ GUINT_TO_POINTER(versionMajor), NULL);
+ mwSession_setProperty(session, mwSession_CLIENT_VER_MINOR,
+ GUINT_TO_POINTER(versionMinor), NULL);
+ }
+
+
/* go!! */
mwSession_start(session);
}
@@ -872,6 +928,11 @@ void MeanwhileSession::handleStorageLoad
mwSametimeList_free(list);
}
+const struct MeanwhileClientID *MeanwhileSession::getClientIDs()
+{
+ return ids;
+}
+
#if 0
MEANWHILE_HOOK_CONFERENCE(conference_invite,
(struct mwConference *conf, struct mwLoginInfo *inviter,
Index: kdenetwork/kopete/protocols/meanwhile/meanwhileaccount.cpp
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhileaccount.cpp 2008-10-31 \
18:41:51.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhileaccount.cpp 2008-10-31 \
18:43:15.000000000 +1100 @@ -108,9 +108,7 @@ void MeanwhileAccount::connectWithPasswo
if (!m_session->isConnected() && !m_session->isConnecting())
- m_session->connect(configGroup()->readEntry("Server"),
- configGroup()->readEntry("Port").toInt(),
- m_meanwhileId, password);
+ m_session->connect(password);
m_session->setStatus(initialStatus());
}
@@ -168,6 +166,36 @@ void MeanwhileAccount::setServerPort(int
configGroup()->writeEntry("Port", port);
}
+void MeanwhileAccount::setClientID(int client, int major, int minor)
+{
+ configGroup()->writeEntry("clientID", client);
+ configGroup()->writeEntry("clientVersionMajor", major);
+ configGroup()->writeEntry("clientVersionMinor", minor);
+}
+
+void MeanwhileAccount::resetClientID()
+{
+ configGroup()->deleteEntry("clientID");
+ configGroup()->deleteEntry("clientVersionMajor");
+ configGroup()->deleteEntry("clientVersionMinor");
+}
+
+bool MeanwhileAccount::getClientIDParams(int *clientID,
+ int *verMajor, int *verMinor)
+{
+ bool custom_id = configGroup()->hasKey("clientID");
+
+ MeanwhileSession::getDefaultClientIDParams(clientID, verMajor, verMinor);
+
+ if (custom_id) {
+ *clientID = configGroup()->readEntry("clientID", *clientID);
+ *verMajor = configGroup()->readEntry("clientVersionMajor", *verMinor);
+ *verMinor = configGroup()->readEntry("clientVersionMinor", *verMinor);
+ }
+
+ return custom_id;
+}
+
void MeanwhileAccount::slotServerNotification(const QString &mesg)
{
KMessageBox::queuedMessageBox(0, KMessageBox::Error , mesg,
Index: kdenetwork/kopete/protocols/meanwhile/meanwhileaccount.h
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhileaccount.h 2008-10-31 \
18:41:51.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhileaccount.h 2008-10-31 \
18:43:15.000000000 +1100 @@ -61,6 +61,15 @@ public:
/** Provide an information plugin for this account */
void setPlugin(MeanwhilePlugin *plugin);
+ /** Set the client identification parameters for the sametime connection */
+ void setClientID(int client, int major, int minor);
+
+ /** Returns true if custom IDs are in use, and populates the args */
+ bool getClientIDParams(int *clientID, int *verMajor, int *verMinor);
+
+ /** Reset client identification parameters to their defaults */
+ void resetClientID();
+
MeanwhilePlugin *infoPlugin;
/**
Index: kdenetwork/kopete/protocols/meanwhile/meanwhileeditaccountwidget.cpp
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhileeditaccountwidget.cpp 2008-10-31 \
18:41:51.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhileeditaccountwidget.cpp 2008-10-31 \
18:43:15.000000000 +1100 @@ -23,6 +23,7 @@
#include "meanwhileprotocol.h"
#include "meanwhileaccount.h"
#include "meanwhileeditaccountwidget.h"
+#include "meanwhilesession.h"
#define DEFAULT_SERVER "messaging.opensource.ibm.com"
#define DEFAULT_PORT 1533
@@ -38,15 +39,32 @@ MeanwhileEditAccountWidget::MeanwhileEdi
ui.setupUi(this);
+ /* setup client identifier combo box */
+ setupClientList();
+
if (account())
{
+ int clientID, verMajor, verMinor;
+ bool useCustomID;
+
ui.mScreenName->setText(account()->accountId());
ui.mScreenName->setReadOnly(true);
ui.mPasswordWidget->load(&static_cast<MeanwhileAccount*>(account())->password());
ui.mAutoConnect->setChecked(account()->excludeConnect());
MeanwhileAccount *myAccount = static_cast<MeanwhileAccount *>(account());
+
+ useCustomID = myAccount->getClientIDParams(&clientID,
+ &verMajor, &verMinor);
+
ui.mServerName->setText(myAccount->getServerName());
ui.mServerPort->setValue(myAccount->getServerPort());
+
+ if (useCustomID) {
+ selectClientListItem(clientID);
+ ui.mClientVersionMajor->setValue(verMajor);
+ ui.mClientVersionMinor->setValue(verMinor);
+ ui.chkCustomClientID->setChecked(true);
+ }
}
else
{
@@ -62,6 +80,38 @@ MeanwhileEditAccountWidget::~MeanwhileEd
{
}
+void MeanwhileEditAccountWidget::setupClientList()
+{
+ const struct MeanwhileClientID *id;
+ int i = 0;
+
+ for (id = MeanwhileSession::getClientIDs(); id->name; id++, i++) {
+ QString name = QString("%1 (0x%2)")
+ .arg(QString(id->name))
+ .arg(id->id, 0, 16);
+
+ mwDebug() << "name: " << name << endl;
+
+ ui.mClientID->insertItem(i, name);
+
+ if (id->id == mwLogin_MEANWHILE)
+ ui.mClientID->setCurrentIndex(i);
+ }
+}
+
+void MeanwhileEditAccountWidget::selectClientListItem(int selectedID)
+{
+ const struct MeanwhileClientID *id;
+ int i = 0;
+
+ for (id = MeanwhileSession::getClientIDs(); id->name; id++, i++) {
+ if (id->id == selectedID) {
+ ui.mClientID->setCurrentIndex(i);
+ break;
+ }
+ }
+}
+
Kopete::Account* MeanwhileEditAccountWidget::apply()
{
@@ -77,6 +127,16 @@ Kopete::Account* MeanwhileEditAccountWid
myAccount->setServerName(ui.mServerName->text().trimmed());
myAccount->setServerPort(ui.mServerPort->value());
+ if (ui.chkCustomClientID->isChecked()) {
+ const struct MeanwhileClientID *ids = MeanwhileSession::getClientIDs();
+ myAccount->setClientID(ids[ui.mClientID->currentIndex()].id,
+ ui.mClientVersionMajor->value(),
+ ui.mClientVersionMinor->value());
+ } else {
+ myAccount->resetClientID();
+ }
+
+
return myAccount;
}
@@ -115,8 +175,17 @@ bool MeanwhileEditAccountWidget::validat
void MeanwhileEditAccountWidget::slotSetServer2Default()
{
+ int clientID, verMajor, verMinor;
+
+ MeanwhileSession::getDefaultClientIDParams(&clientID,
+ &verMajor, &verMinor);
+
ui.mServerName->setText(DEFAULT_SERVER);
ui.mServerPort->setValue(DEFAULT_PORT);
+ ui.chkCustomClientID->setChecked(false);
+ selectClientListItem(clientID);
+ ui.mClientVersionMajor->setValue(verMajor);
+ ui.mClientVersionMinor->setValue(verMinor);
}
#include "meanwhileeditaccountwidget.moc"
Index: kdenetwork/kopete/protocols/meanwhile/meanwhileeditaccountwidget.h
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhileeditaccountwidget.h 2008-10-31 \
18:41:51.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhileeditaccountwidget.h 2008-10-31 \
18:43:15.000000000 +1100 @@ -47,6 +47,8 @@ protected:
private:
Ui::MeanwhileEditAccount ui;
+ void setupClientList();
+ void selectClientListItem(int selectedID);
};
#endif
Index: kdenetwork/kopete/protocols/meanwhile/ui/meanwhileeditaccount.ui
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/ui/meanwhileeditaccount.ui 2008-10-31 \
18:41:51.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/ui/meanwhileeditaccount.ui 2008-10-31 \
18:43:28.000000000 +1100 @@ -5,10 +5,16 @@
<rect>
<x>0</x>
<y>0</y>
- <width>640</width>
- <height>450</height>
+ <width>669</width>
+ <height>414</height>
</rect>
</property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="windowTitle" >
<string>Edit Meanwhile Account</string>
</property>
@@ -25,14 +31,6 @@
<number>0</number>
</property>
<widget class="QWidget" name="tab" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>632</width>
- <height>416</height>
- </rect>
- </property>
<attribute name="title" >
<string>B&asic Setup</string>
</attribute>
@@ -95,24 +93,22 @@
</layout>
</widget>
<widget class="QWidget" name="tab" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>632</width>
- <height>416</height>
- </rect>
- </property>
<attribute name="title" >
<string>Connection</string>
</attribute>
<layout class="QVBoxLayout" >
<item>
<widget class="Q3GroupBox" name="groupBox54" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
<property name="title" >
<string>Connection Preferences</string>
</property>
- <layout class="QVBoxLayout" >
+ <layout class="QVBoxLayout" name="verticalLayout_3" >
<item>
<layout class="QHBoxLayout" >
<item>
@@ -190,16 +186,115 @@
</item>
</layout>
</item>
- <item>
- <widget class="QPushButton" name="btnServerDefaults" >
- <property name="toolTip" >
- <string>Restore the server and port values to their \
defaults.</string> + </layout>
+ </item>
+ </layout>
+ <zorder></zorder>
+ </widget>
+ </item>
+ <item>
+ <widget class="Q3GroupBox" name="groupBox5" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title" >
+ <string>Client Identifier</string>
+ </property>
+ <layout class="QVBoxLayout" name="_2" >
+ <item>
+ <widget class="QCheckBox" name="chkCustomClientID" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Use custom client identifier</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="_3" >
+ <item row="0" column="1" >
+ <widget class="QComboBox" name="mClientID" >
+ <property name="enabled" >
+ <bool>false</bool>
</property>
- <property name="whatsThis" >
- <string>Restore the server and port values to their \
defaults.</string> + </widget>
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="lblClientIdentifier" >
+ <property name="enabled" >
+ <bool>false</bool>
</property>
<property name="text" >
- <string>&Defaults</string>
+ <string>Client identifier</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>mClientID</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <layout class="QHBoxLayout" name="_4" >
+ <item>
+ <widget class="QSpinBox" name="mClientVersionMajor" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="maximum" >
+ <number>65535</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="lblVersionSeparator" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>.</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="mClientVersionMinor" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="maximum" >
+ <number>65535</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="lblClientVersion" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Client version (major.minor)</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>mClientVersionMajor</cstring>
</property>
</widget>
</item>
@@ -209,14 +304,36 @@
</widget>
</item>
<item>
- <spacer name="spacer31" >
- <property name="sizeType" >
- <enum>QSizePolicy::Expanding</enum>
+ <widget class="QPushButton" name="btnServerDefaults" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip" >
+ <string>Restore the server and port values to their defaults.</string>
+ </property>
+ <property name="whatsThis" >
+ <string>Restore the server and port values to their defaults.</string>
+ </property>
+ <property name="text" >
+ <string>Restore &Defaults</string>
+ </property>
+ <property name="shortcut" >
+ <string>Alt+D</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
- <height>71</height>
+ <height>40</height>
</size>
</property>
</spacer>
@@ -245,5 +362,102 @@
<tabstop>mScreenName</tabstop>
</tabstops>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>chkCustomClientID</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>mClientID</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>319</x>
+ <y>139</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>471</x>
+ <y>167</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>chkCustomClientID</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>mClientVersionMajor</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>319</x>
+ <y>139</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>371</x>
+ <y>197</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>chkCustomClientID</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>mClientVersionMinor</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>319</x>
+ <y>139</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>572</x>
+ <y>197</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>chkCustomClientID</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>lblClientIdentifier</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>319</x>
+ <y>139</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>167</x>
+ <y>167</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>chkCustomClientID</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>lblClientVersion</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>319</x>
+ <y>139</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>167</x>
+ <y>197</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>chkCustomClientID</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>lblVersionSeparator</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>319</x>
+ <y>139</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>471</x>
+ <y>197</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
</ui>
Index: kdenetwork/kopete/protocols/meanwhile/meanwhilesession.h
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhilesession.h 2008-10-31 \
18:41:51.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhilesession.h 2008-10-31 \
18:43:15.000000000 +1100 @@ -28,6 +28,12 @@
class QTcpSocket;
+struct MeanwhileClientID {
+ int id;
+ const char *name;
+};
+
+
/**
* A class to handle libmeanwhile session management.
*/
@@ -53,7 +59,7 @@ public:
* the connection process is ascychronous - a loginDone() signal will be
* emitted when successfully logged in.
*/
- void connect(QString host, int port, QString account, QString password);
+ void connect(QString password);
/**
* Disconnect from the server.
@@ -108,6 +114,17 @@ public:
*/
bool isConnecting();
+ /**
+ * Returns an array of well-known meanwhile client IDs
+ */
+ static const struct MeanwhileClientID *getClientIDs();
+
+ /**
+ * Get the default client ID parameters for kopete
+ */
+ static void getDefaultClientIDParams(int *clientID,
+ int *verMajor, int *verMinor);
+
signals:
/**
* Emitted when the status of the connection changes
["fix-add-dialog.patch" (text/x-patch)]
protocols/meanwhile: don't show addcontact widget as separate dialog
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Index: kdenetwork/kopete/protocols/meanwhile/meanwhileaddcontactpage.cpp
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhileaddcontactpage.cpp 2008-11-07 \
11:05:34.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhileaddcontactpage.cpp 2008-11-07 \
11:05:46.000000000 +1100 @@ -28,8 +28,7 @@ MeanwhileAddContactPage::MeanwhileAddCon
: AddContactPage(parent), theAccount(_account),
theParent(parent)
{
- QDialog *dialog = new QDialog(this);
- ui.setupUi(dialog);
+ ui.setupUi(this);
MeanwhileAccount *account = static_cast<MeanwhileAccount *>(_account);
if (account->infoPlugin->canProvideMeanwhileId()) {
@@ -37,7 +36,6 @@ MeanwhileAddContactPage::MeanwhileAddCon
} else {
ui.btnFindUser->setDisabled(true);
}
- dialog->show();
}
MeanwhileAddContactPage::~MeanwhileAddContactPage()
Index: kdenetwork/kopete/protocols/meanwhile/meanwhileaddcontactpage.h
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/meanwhileaddcontactpage.h 2008-11-07 \
10:56:40.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/meanwhileaddcontactpage.h 2008-11-07 \
10:57:18.000000000 +1100 @@ -35,7 +35,7 @@ public:
virtual bool validateData();
protected:
- Ui::AddContactDialog ui;
+ Ui::MeanwhileAddUI ui;
Kopete::Account *theAccount;
QWidget *theParent;
Index: kdenetwork/kopete/protocols/meanwhile/ui/meanwhileaddcontact.ui
===================================================================
--- kdenetwork.orig/kopete/protocols/meanwhile/ui/meanwhileaddcontact.ui 2008-11-07 \
10:55:29.000000000 +1100
+++ kdenetwork/kopete/protocols/meanwhile/ui/meanwhileaddcontact.ui 2008-11-07 \
10:59:13.000000000 +1100 @@ -1,6 +1,6 @@
<ui version="4.0" >
- <class>AddContactDialog</class>
- <widget class="QDialog" name="AddContactDialog" >
+ <class>MeanwhileAddUI</class>
+ <widget class="QWidget" name="MeanwhileAddUI" >
<property name="geometry" >
<rect>
<x>0</x>
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic