]> git.tokkee.org Git - inkscape.git/commitdiff

Code

Users Jid is now stored in session data, which is used in from attributes. lm_connect...
authordaleharvey <daleharvey@users.sourceforge.net>
Wed, 10 May 2006 14:34:38 +0000 (14:34 +0000)
committerdaleharvey <daleharvey@users.sourceforge.net>
Wed, 10 May 2006 14:34:38 +0000 (14:34 +0000)
src/jabber_whiteboard/connection-establishment.cpp
src/jabber_whiteboard/message-handler.cpp
src/jabber_whiteboard/message-queue.cpp
src/jabber_whiteboard/node-tracker.cpp
src/jabber_whiteboard/session-manager.cpp
src/jabber_whiteboard/session-manager.h
src/ui/dialog/whiteboard-sharewithchat.cpp

index 2fb367bed7014f33108b884370fd62f84d5f1117..d33d6d6b2a3767d27b661302e381e5980bf86ca4 100644 (file)
@@ -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 <x xmlns='http://jabber.org/protocol/muc/' />
        // (Not anymore: we don't speak it! -- yipdw)
@@ -284,7 +284,7 @@ SessionManager::receiveConnectRequestResponse(InvitationResponses response, std:
                        Glib::ustring primary = String::ucompose(_("<span weight=\"bold\" size=\"larger\">The user <b>%1</b> has refused your whiteboard invitation.</span>\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 <b>%2</b>, and may send an invitation to <b>%1</b> 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 <b>%2</b>, and may send an invitation to <b>%1</b> 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();
index 56c6972de3101c64f714c99a726d6526794bfa4f..9551a8e27c13314db8a233bda9c165708c0813c4 100644 (file)
@@ -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;
index 21cd76f178a86f947564a9599b1f84f3d900aaf8..4bd1e9ab1304b5d58825688490f9b3049e71fc4e 100644 (file)
@@ -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());
 }
 
 }
index 07f9069eba01fc3b3fc817e028cd1ce45256aa82..84bc12945bee60ed9d9f4dc7749ee9ae362499d3 100644 (file)
@@ -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();
index ec26d20a95deeab0cbe261ee35b053f3efe36539..d9c9c4613ad24d7a561236920641391c1981eee3 100644 (file)
@@ -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(_("<span weight=\"bold\" size=\"larger\">The user <b>%1</b> has left the whiteboard session.</span>\n\n"), JID);
        // TRANSLATORS: %1 and %2 are userids
-       Glib::ustring secondary = String::ucompose(_("You are still connected to a Jabber server as <b>%2</b>, and may establish a new session to <b>%1</b> 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 <b>%2</b>, and may establish a new session to <b>%1</b> 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);
index d52cca3de4d01427c6e57bf945e0b4330ef504e9..a1c4ccc69a966b71625eb198a5494c3da65aadc9 100644 (file)
@@ -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.
         */
index eed9fa168fab1fa5e845775b650f20c1d9e887b5..8d33328bab90c510852869b809b063f02ae03144 100644 (file)
@@ -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");