From: dwyip Date: Mon, 29 May 2006 02:54:34 +0000 (+0000) Subject: applied JID patch by Alexander Darovsky X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2922bf6d0d2fc7a5cedf2e0e53d6eeddd9a0a4b2;p=inkscape.git applied JID patch by Alexander Darovsky (see https://sourceforge.net/tracker/?func=detail&atid=604306&aid=1495414&group_id=93438) --- 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.