Code

Persist User / Server / ChatServer name across succesful sessions (Given By Botty)
authordaleharvey <daleharvey@users.sourceforge.net>
Mon, 8 May 2006 17:58:44 +0000 (17:58 +0000)
committerdaleharvey <daleharvey@users.sourceforge.net>
Mon, 8 May 2006 17:58:44 +0000 (17:58 +0000)
src/jabber_whiteboard/chat-handler.cpp
src/jabber_whiteboard/connection-establishment.cpp
src/jabber_whiteboard/session-manager.cpp
src/preferences-skeleton.h
src/ui/dialog/whiteboard-connect.cpp
src/ui/dialog/whiteboard-sharewithchat.cpp

index bdb840066986d3d9b1e59407697dcc55df52e84a..b3e906508668e5c06cddd60a4ac1addd5d1884da 100644 (file)
@@ -137,6 +137,7 @@ ChatMessageHandler::parse(LmMessage* message)
                                                this->_sm->session_data->receive_queues[sender.raw()] = new ReceiveMessageQueue(this->_sm);
                                                
                                        } else {
+                                               //g_warning("hmm, who is chatting %s",chatter);
                                                // If the presence message is from ourselves, then we know that we 
                                                // have successfully entered the chatroom _and_ have received the entire room roster,
                                                // and can therefore decide whether we need to synchronize with the rest of the room.
index 5cc9e053d11af0264914b8fcec8a65930c0ab14b..2fb367bed7014f33108b884370fd62f84d5f1117 100644 (file)
@@ -19,6 +19,8 @@
 #include "file.h"
 #include "document.h"
 
+#include "prefs-utils.h"
+
 #include "xml/repr.h"
 
 #include "jabber_whiteboard/defines.h"
@@ -90,6 +92,13 @@ SessionManager::sendRequestToChatroom(Glib::ustring const& server, Glib::ustring
        this->session_data->chat_server = server;
        this->session_data->chat_name = chatroom;
 
+       prefs_set_string_attribute("whiteboard.room", "name", chatroom.c_str());
+       prefs_set_string_attribute("whiteboard.room", "server", server.c_str());
+       //Commented out because you can use whiteboard.server.username
+       //prefs_set_string_attribute("whiteboard.room", "handle", handle.c_str());
+       //store password here?
+
+
        this->setRecipient(String::ucompose("%1@%2", chatroom, server).data());
 
        lm_message_unref(presence_req);
index 5a7dda4266b5e8f260c46c6ccf21cb7cf7c81afe..9a314842ea928bde9cfb32ff71f3fcf7e99e1c45 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "gc-anchored.h"
 
+#include "prefs-utils.h"
+
 #include "xml/repr.h"
 #include "xml/node-observer.h"
 
@@ -289,6 +291,14 @@ SessionManager::connectToServer(Glib::ustring const& server, Glib::ustring const
 
        this->_setVerbSensitivity(ESTABLISHED_CONNECTION);
 
+       //On successful connect, remember info
+       prefs_set_string_attribute("whiteboard.server", "name", server.c_str());
+       prefs_set_string_attribute("whiteboard.server", "port", port.c_str());
+       prefs_set_string_attribute("whiteboard.server", "username", username.c_str());
+       prefs_set_int_attribute("whiteboard.server", "ssl", (usessl) ? 1 : 0);
+       //Option to store password here?
+
+
        return CONNECT_SUCCESS;
 }
 
index 2fed2b3dff28c926615e38d532deedbde9518f93..92288cb65de9f235aaa7dba6c4e47507ec621a6f 100644 (file)
@@ -247,6 +247,10 @@ static char const preferences_skeleton[] =
 "      </group>\n"
 "    </group>\n"
 "  </group>\n"
+"  <group id = \"whiteboard\">\n"
+"    <group id = \"server\" name = \"jabber.org\" port = \"5222\" username = \"\" ssl = \"0\"/>\n"
+"    <group id = \"room\" name = \"inkboard\" server = \"gristle.org\"/>\n"
+"  </group>\n"
 "\n"
 "</inkscape>\n";
 
index 50f44e5f72306fbdbbde3fe5b7b3d9c9dd7a94af..cb873b904e3763c2472333da1debc00a46007508 100644 (file)
@@ -81,7 +81,10 @@ WhiteboardConnectDialogImpl::_construct()
        this->_labels[2].set_mnemonic_widget(this->_password);
        this->_labels[3].set_mnemonic_widget(this->_port);
 
-       this->_port.set_text("5222");
+       this->_server.set_text(prefs_get_string_attribute("whiteboard.server", "name"));
+       this->_port.set_text(prefs_get_string_attribute("whiteboard.server", "port"));
+       this->_username.set_text(prefs_get_string_attribute("whiteboard.server", "username"));
+       this->_usessl.set_active((prefs_get_int_attribute("whiteboard.server", "ssl", 0) == 1) ? true : false);
 
        this->_layout.attach(this->_labels[0], 0, 1, 0, 1);
        this->_layout.attach(this->_labels[3], 2, 3, 0, 1);
index 4c86b0dfac416dfac6e4af439e2eae254396ca20..eed9fa168fab1fa5e845775b650f20c1d9e887b5 100644 (file)
@@ -20,6 +20,8 @@
 #include "inkscape.h"
 #include "desktop.h"
 
+#include "prefs-utils.h"
+
 #include "jabber_whiteboard/typedefs.h"
 #include "jabber_whiteboard/session-manager.h"
 #include "jabber_whiteboard/buddy-list-manager.h"
@@ -80,6 +82,11 @@ WhiteboardShareWithChatroomDialogImpl::_construct()
        this->_labels[2].set_mnemonic_widget(this->_roompass);
        this->_labels[3].set_mnemonic_widget(this->_handle);
 
+
+       this->_roomname.set_text(prefs_get_string_attribute("whiteboard.room", "name"));
+       this->_confserver.set_text(prefs_get_string_attribute("whiteboard.room", "server"));
+       this->_handle.set_text(prefs_get_string_attribute("whiteboard.server", "username"));
+
        // Pack table
        this->_layout.attach(this->_labels[0], 0, 1, 0, 1);
        this->_layout.attach(this->_labels[1], 0, 1, 1, 2);