summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8ebf3a0)
raw | patch | inline | side by side (parent: 8ebf3a0)
author | dwyip <dwyip@users.sourceforge.net> | |
Mon, 29 May 2006 02:54:34 +0000 (02:54 +0000) | ||
committer | dwyip <dwyip@users.sourceforge.net> | |
Mon, 29 May 2006 02:54:34 +0000 (02:54 +0000) |
src/jabber_whiteboard/session-manager.cpp | patch | blob | history | |
src/jabber_whiteboard/session-manager.h | patch | blob | history |
index d391089016a81badfd7da6d24b9fcb225220c26a..9ead6b60b70857f30049447faa9430a4363cd800 100644 (file)
@@ -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) {
index 06a3cd4c50f524f01893d3f8aff1b08044344c71..a273fef4dedf9c3d6b76856e54b4e5cc72dd6db0 100644 (file)
* 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.