From 2922bf6d0d2fc7a5cedf2e0e53d6eeddd9a0a4b2 Mon Sep 17 00:00:00 2001 From: dwyip Date: Mon, 29 May 2006 02:54:34 +0000 Subject: [PATCH] applied JID patch by Alexander Darovsky (see https://sourceforge.net/tracker/?func=detail&atid=604306&aid=1495414&group_id=93438) --- src/jabber_whiteboard/session-manager.cpp | 16 ++++++++++++++-- src/jabber_whiteboard/session-manager.h | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/jabber_whiteboard/session-manager.cpp b/src/jabber_whiteboard/session-manager.cpp index d39108901..9ead6b60b 100644 --- a/src/jabber_whiteboard/session-manager.cpp +++ b/src/jabber_whiteboard/session-manager.cpp @@ -331,13 +331,25 @@ SessionManager::registerWithServer(Glib::ustring const& username, Glib::ustring int SessionManager::connectToServer(Glib::ustring const& server, Glib::ustring const& port, - Glib::ustring const& username, Glib::ustring const& pw, bool usessl) + Glib::ustring const& entered_username, Glib::ustring const& pw, bool usessl) { GError* error = NULL; + Glib::ustring username; + Glib::ustring jid; initializeConnection(server,port,usessl); - this->session_data->jid = username + "@" + server + "/" + RESOURCE_NAME; + Glib::ustring::size_type atPos = entered_username.find('@'); + + if (atPos != Glib::ustring::npos) { + jid += entered_username; + username = entered_username.substr(0, atPos); + } else { + jid += entered_username + "@" + server + "/" + RESOURCE_NAME; + username = entered_username; + } + + this->session_data->jid = jid; if (!lm_connection_authenticate_and_block(this->session_data->connection, username.c_str(), pw.c_str(), RESOURCE_NAME, &error)) { if (error != NULL) { diff --git a/src/jabber_whiteboard/session-manager.h b/src/jabber_whiteboard/session-manager.h index 06a3cd4c5..a273fef4d 100644 --- a/src/jabber_whiteboard/session-manager.h +++ b/src/jabber_whiteboard/session-manager.h @@ -245,14 +245,14 @@ public: * Connect to a Jabber server. * * @param server Jabber server URL - * @param username Jabber username + * @param entered_username Jabber username provided by user (may also be full JID) * @param pw password for Jabber account * @param usessl use SSL for connection * * @return CONNECT_SUCCESS if connection successful; FAILED_TO_CONNECT if connection failed or INVALID_AUTH * if authentication invalid */ - int connectToServer(Glib::ustring const& server, Glib::ustring const& port, Glib::ustring const& username, Glib::ustring const& pw, bool usessl); + int connectToServer(Glib::ustring const& server, Glib::ustring const& port, Glib::ustring const& entered_username, Glib::ustring const& pw, bool usessl); /** * Register with a Jabber server. -- 2.30.2