From: daleharvey Date: Wed, 10 May 2006 14:34:38 +0000 (+0000) Subject: Users Jid is now stored in session data, which is used in from attributes. lm_connect... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=40d7846d5abbc7b7f18c91875e1677e0b4ac9cb7;p=inkscape.git Users Jid is now stored in session data, which is used in from attributes. lm_connection_set_jid is now not called, which allows authentication against jabber.org --- diff --git a/src/jabber_whiteboard/connection-establishment.cpp b/src/jabber_whiteboard/connection-establishment.cpp index 2fb367bed..d33d6d6b2 100644 --- a/src/jabber_whiteboard/connection-establishment.cpp +++ b/src/jabber_whiteboard/connection-establishment.cpp @@ -62,7 +62,7 @@ SessionManager::sendRequestToChatroom(Glib::ustring const& server, Glib::ustring // Add 'from' attribute LmMessageNode* preq_root = lm_message_get_node(presence_req); - lm_message_node_set_attribute(preq_root, "from", lm_connection_get_jid(this->session_data->connection)); + lm_message_node_set_attribute(preq_root, "from", this->session_data->jid.c_str()); // Add // (Not anymore: we don't speak it! -- yipdw) @@ -284,7 +284,7 @@ SessionManager::receiveConnectRequestResponse(InvitationResponses response, std: Glib::ustring primary = String::ucompose(_("The user %1 has refused your whiteboard invitation.\n\n"), sender); // TRANSLATORS: %1 is the peer whom refused our invitation, %2 is our Jabber identity. - Glib::ustring secondary = String::ucompose(_("You are still connected to a Jabber server as %2, and may send an invitation to %1 again, or you may send an invitation to a different user."), sender, lm_connection_get_jid(this->session_data->connection)); + Glib::ustring secondary = String::ucompose(_("You are still connected to a Jabber server as %2, and may send an invitation to %1 again, or you may send an invitation to a different user."), sender, this->session_data->jid); Gtk::MessageDialog dialog(primary + secondary, true, Gtk::MESSAGE_INFO, Gtk::BUTTONS_CLOSE, false); dialog.run(); diff --git a/src/jabber_whiteboard/message-handler.cpp b/src/jabber_whiteboard/message-handler.cpp index 56c6972de..9551a8e27 100644 --- a/src/jabber_whiteboard/message-handler.cpp +++ b/src/jabber_whiteboard/message-handler.cpp @@ -343,7 +343,7 @@ MessageHandler::_presence(LmMessage* message) case LM_MESSAGE_SUB_TYPE_AVAILABLE: // we don't want to insert an entry into a buddy list // if it's our own presence - if (sender != lm_connection_get_jid(this->_sm->session_data->connection)) { + if (sender != this->_sm->session_data->jid.c_str()) { sd->buddyList.insert(sender); } return LM_HANDLER_RESULT_REMOVE_MESSAGE; diff --git a/src/jabber_whiteboard/message-queue.cpp b/src/jabber_whiteboard/message-queue.cpp index 21cd76f17..4bd1e9ab1 100644 --- a/src/jabber_whiteboard/message-queue.cpp +++ b/src/jabber_whiteboard/message-queue.cpp @@ -42,7 +42,7 @@ void MessageQueue::popFront() { this->_queue.pop_front(); -// g_log(NULL, G_LOG_LEVEL_DEBUG, "Removed element, queue size (for %s): %u", lm_connection_get_jid(this->_sm->session_data->connection), this->_queue.size()); +// g_log(NULL, G_LOG_LEVEL_DEBUG, "Removed element, queue size (for %s): %u", this->_sm->session_data->jid, this->_queue.size()); } unsigned int @@ -88,7 +88,7 @@ ReceiveMessageQueue::insert(MessageNode* msg) "%u changes in receive queue.", this->_queue.size()), this->_queue.size()); -// g_log(NULL, G_LOG_LEVEL_DEBUG, "Receive queue size (for %s): %u", lm_connection_get_jid(this->_sm->session_data->connection), this->_queue.size()); +// g_log(NULL, G_LOG_LEVEL_DEBUG, "Receive queue size (for %s): %u", this->_sm->session_data->jid, this->_queue.size()); } void @@ -118,7 +118,7 @@ SendMessageQueue::insert(MessageNode* msg) "%u changes in send queue.", this->_queue.size()), this->_queue.size()); -// g_log(NULL, G_LOG_LEVEL_DEBUG, "Send queue size (for %s): %u", lm_connection_get_jid(this->_sm->session_data->connection), this->_queue.size()); +// g_log(NULL, G_LOG_LEVEL_DEBUG, "Send queue size (for %s): %u", this->_sm->session_data->jid, this->_queue.size()); } } diff --git a/src/jabber_whiteboard/node-tracker.cpp b/src/jabber_whiteboard/node-tracker.cpp index 07f9069eb..84bc12945 100644 --- a/src/jabber_whiteboard/node-tracker.cpp +++ b/src/jabber_whiteboard/node-tracker.cpp @@ -252,7 +252,7 @@ XMLNodeTracker::generateKey() // of a user. return String::compose("%1;%2@%3/%4", this->_counter++, sd->chat_name, sd->chat_server, sd->chat_handle); } else { - return String::compose("%1;%2", this->_counter++, lm_connection_get_jid(sd->connection)); + return String::compose("%1;%2", this->_counter++, sd->jid); } } @@ -270,7 +270,7 @@ XMLNodeTracker::createSpecialNodeTables() void XMLNodeTracker::dump() { - g_log(NULL, G_LOG_LEVEL_DEBUG, "XMLNodeTracker dump for %s", lm_connection_get_jid(this->_sm->session_data->connection)); + g_log(NULL, G_LOG_LEVEL_DEBUG, "XMLNodeTracker dump for %s", this->_sm->session_data->jid.c_str()); KeyToTrackerNodeMap::iterator i = this->_keyToNode.begin(); TrackerNodeToKeyMap::iterator j = this->_nodeToKey.begin(); std::map< char const*, char const* >::iterator k = this->_specialnodes.begin(); diff --git a/src/jabber_whiteboard/session-manager.cpp b/src/jabber_whiteboard/session-manager.cpp index ec26d20a9..d9c9c4613 100644 --- a/src/jabber_whiteboard/session-manager.cpp +++ b/src/jabber_whiteboard/session-manager.cpp @@ -186,7 +186,7 @@ SessionManager::connectToServer(Glib::ustring const& server, Glib::ustring const Glib::ustring jid; // JID format is username@server/resource - jid += username + "@" + server; + jid += username + "@" + server + "/" + RESOURCE_NAME; LmMessage* m; LmMessageHandler* mh; @@ -208,6 +208,7 @@ SessionManager::connectToServer(Glib::ustring const& server, Glib::ustring const lm_connection_unref(this->session_data->connection); } + this->session_data->jid = jid; this->session_data->connection = lm_connection_new(server.c_str()); lm_connection_set_port(this->session_data->connection, atoi(port.c_str())); @@ -227,7 +228,7 @@ SessionManager::connectToServer(Glib::ustring const& server, Glib::ustring const } // Send authorization - lm_connection_set_jid(this->session_data->connection, jid.c_str()); + //lm_connection_set_jid(this->session_data->connection, jid.c_str()); // TODO: // Asynchronous connection and authentication would be nice, @@ -461,7 +462,7 @@ SessionManager::sendChange(Glib::ustring const& msg, MessageType type, std::stri case CHANGE_REPEATABLE: case CHANGE_COMMIT: { - MessageNode *newNode = new MessageNode(this->session_data->sequence_number++, lm_connection_get_jid(this->session_data->connection), recipient, msg, type, false, chatroom); + MessageNode *newNode = new MessageNode(this->session_data->sequence_number++, this->session_data->jid, recipient, msg, type, false, chatroom); this->session_data->send_queue->insert(newNode); Inkscape::GC::release(newNode); break; @@ -492,7 +493,7 @@ SessionManager::sendMessage(MessageType msgtype, unsigned int sequence, Glib::us m = lm_message_new(recipientJID, LM_MESSAGE_TYPE_MESSAGE); // add sender - lm_message_node_set_attribute(m->node, "from", lm_connection_get_jid(this->session_data->connection)); + lm_message_node_set_attribute(m->node, "from", this->session_data->jid.c_str()); // set message subtype according to whether or not this is // destined for a chatroom @@ -806,7 +807,7 @@ SessionManager::userDisconnectedFromWhiteboard(std::string const& JID) // This message is not used in a chatroom context. Glib::ustring primary = String::ucompose(_("The user %1 has left the whiteboard session.\n\n"), JID); // TRANSLATORS: %1 and %2 are userids - Glib::ustring secondary = String::ucompose(_("You are still connected to a Jabber server as %2, and may establish a new session to %1 or a different user."), JID, lm_connection_get_jid(this->session_data->connection)); + Glib::ustring secondary = String::ucompose(_("You are still connected to a Jabber server as %2, and may establish a new session to %1 or a different user."), JID, this->session_data->jid); // TODO: parent this dialog to the active desktop Gtk::MessageDialog dialog(primary + secondary, true, Gtk::MESSAGE_INFO, Gtk::BUTTONS_CLOSE, false); diff --git a/src/jabber_whiteboard/session-manager.h b/src/jabber_whiteboard/session-manager.h index d52cca3de..a1c4ccc69 100644 --- a/src/jabber_whiteboard/session-manager.h +++ b/src/jabber_whiteboard/session-manager.h @@ -116,6 +116,11 @@ public: */ Glib::ustring chat_handle; + /** + * The Users Jid. + */ + Glib::ustring jid; + /** * Name of the chatroom that a user in a chatroom is connected to. */ diff --git a/src/ui/dialog/whiteboard-sharewithchat.cpp b/src/ui/dialog/whiteboard-sharewithchat.cpp index eed9fa168..8d33328ba 100644 --- a/src/ui/dialog/whiteboard-sharewithchat.cpp +++ b/src/ui/dialog/whiteboard-sharewithchat.cpp @@ -112,7 +112,7 @@ WhiteboardShareWithChatroomDialogImpl::_construct() this->_buttonsbox.pack_start(this->_share); // Set default values - Glib::ustring jid = lm_connection_get_jid(this->_sm->session_data->connection); + Glib::ustring jid = this->_sm->session_data->jid; Glib::ustring nick = jid.substr(0, jid.find_first_of('@')); this->_handle.set_text(nick); this->_roomname.set_text("inkboard");