/* external interface called by meanwhileaccount */ 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); Kopete::SocketTimeoutWatcher* timeoutWatcher = Kopete::SocketTimeoutWatcher::watch(sock); if (timeoutWatcher) QObject::connect(timeoutWatcher, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotSocketAboutToClose())); sock->connectToHost(host, quint16(port)); // TODO - make asynchronous if (!sock->waitForConnected()) { 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 */ QObject::connect(sock, SIGNAL(readyRead()), this, SLOT(slotSocketDataAvailable())); QObject::connect(sock, SIGNAL(aboutToClose()), this, SLOT(slotSocketAboutToClose())); /* set login details */ mwSession_setProperty(session, mwSession_AUTH_USER_ID, 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); }
void CSametimeProto::InitMeanwhileServices() { debugLog(_T("InitMeanwhileServices() start")); if (options.encrypt_session) { mwSession_addCipher(session, mwCipher_new_RC2_128(session)); mwSession_addCipher(session, mwCipher_new_RC2_40(session)); } InitUserList(); InitMessaging(); InitFiles(); InitConference(); mwSession_setProperty(session, "PROTO_STRUCT_PTR", this, NULL); mwSession_setProperty(session, mwSession_AUTH_USER_ID, options.id, NULL); mwSession_setProperty(session, mwSession_AUTH_PASSWORD, options.pword, NULL); mwSession_setProperty(session, mwSession_CLIENT_TYPE_ID, (void*)options.client_id, NULL); if (options.use_old_default_client_ver) { mwSession_setProperty(session, mwSession_CLIENT_VER_MAJOR, GUINT_TO_POINTER(db_get_w(0, m_szModuleName, "ClientVersionMajor", MW_PROTOCOL_VERSION_MAJOR)), 0); mwSession_setProperty(session, mwSession_CLIENT_VER_MINOR, GUINT_TO_POINTER(db_get_w(0, m_szModuleName, "ClientVersionMinor", MW_PROTOCOL_VERSION_MINOR)), 0); } else { mwSession_setProperty(session, mwSession_CLIENT_VER_MAJOR, GUINT_TO_POINTER(db_get_w(0, m_szModuleName, "ClientVersionMajor", 0x001e)), 0); mwSession_setProperty(session, mwSession_CLIENT_VER_MINOR, GUINT_TO_POINTER(db_get_w(0, m_szModuleName, "ClientVersionMinor", 0x196f)), 0); } }
void CSametimeProto::InitMeanwhileServices() { debugLog(_T("InitMeanwhileServices() start")); if (options.encrypt_session) { mwSession_addCipher(session, mwCipher_new_RC2_128(session)); mwSession_addCipher(session, mwCipher_new_RC2_40(session)); } InitUserList(); InitMessaging(); InitFiles(); InitConference(); mwSession_setProperty(session, "PROTO_STRUCT_PTR", this, NULL); mwSession_setProperty(session, mwSession_AUTH_USER_ID, options.id, NULL); mwSession_setProperty(session, mwSession_AUTH_PASSWORD, options.pword, NULL); mwSession_setProperty(session, mwSession_CLIENT_TYPE_ID, (void*)options.client_id, NULL); mwSession_setProperty(session, mwSession_CLIENT_VER_MAJOR, (void*)options.client_versionMajor, NULL); mwSession_setProperty(session, mwSession_CLIENT_VER_MINOR, (void*)options.client_versionMinor, NULL); }