summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Yip <yipdw@alumni.rose-hulman.edu>2006-02-10 19:13:32 +0000
committerdwyip <dwyip@users.sourceforge.net>2006-02-10 19:13:32 +0000
commit24530f311ba7cea8cb9996ed1f6cddaaa2cfe36b (patch)
treee93e737e81f5a081e821855827e39b4873881c9b /src
parentrename so that this option will not be mistaken for generalized DXF output (diff)
downloadinkscape-24530f311ba7cea8cb9996ed1f6cddaaa2cfe36b.tar.gz
inkscape-24530f311ba7cea8cb9996ed1f6cddaaa2cfe36b.zip
Fix for bug #1352522 (Inkboard: problem when invited person invites you back). I'm not marking it as CLOSED because there's still some testing left to do, but I
think this should nail it. (bzr r113)
Diffstat (limited to 'src')
-rw-r--r--src/jabber_whiteboard/connection-establishment.cpp37
-rw-r--r--src/jabber_whiteboard/message-contexts.cpp5
-rw-r--r--src/jabber_whiteboard/message-handler.cpp3
3 files changed, 43 insertions, 2 deletions
diff --git a/src/jabber_whiteboard/connection-establishment.cpp b/src/jabber_whiteboard/connection-establishment.cpp
index 9382227fb..eba75d9a4 100644
--- a/src/jabber_whiteboard/connection-establishment.cpp
+++ b/src/jabber_whiteboard/connection-establishment.cpp
@@ -121,8 +121,45 @@ SessionManager::receiveConnectRequest(gchar const* requesterJID)
return;
}
+ if (this->session_data->status[WAITING_FOR_INVITE_RESPONSE]) {
+ // Whoops. Someone tried to invite us while we were inviting someone else
+ // (maybe it was the someone we were trying to invite, maybe it was someone else).
+ //
+ // Our response is to reject the second request, as we can only handle one
+ // invitation at a time. Also, we notify the user (who is waiting for an invitation
+ // response) of the rejection event.
+ this->sendMessage(CONNECT_REQUEST_REFUSED_BY_PEER, 0, "", requesterJID, false);
+
+ Glib::ustring primary = "<span weight=\"bold\" size=\"larger\">";
+
+ // TRANSLATORS: This string is used to inform an Inkboard user that the following
+ // scenario has occurred:
+ // 1. Alice invites Bob to an Inkboard session.
+ // 2. While Alice's invitation is en route, Bob invites Alice to an Inkboard session.
+ //
+ // Or, we might have the following scenario:
+ // 1. Alice invites Bob to an Inkboard session.
+ // 2. While Alice is waiting for Bob's response, Carol sends Alice an invitation.
+ //
+ // In the current implementation, we can only handle one invitation at a time,
+ // so we reject all others.
+ //
+ // This is a fix for bug #1352522. Probably not the friendliest, but it's about
+ // the best we can do without changing the protocol.
+ primary += _("<b>An invitation conflict has occurred.</b>");
+ primary += "</span>\n\n";
+
+ // TRANSLATORS: %1 is the JID of the user who sent us the invitation request.
+ primary += String::ucompose(_("The Jabber user <b>%1</b> attempted to invite you to a whiteboard session while you were waiting on an invitation response.\n\nThe invitation from <b>%1</b> has been rejected."), requesterJID);
+
+ Gtk::MessageDialog dialog(primary, true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_CLOSE, false);
+ dialog.run();
+ return;
+ }
+
if (this->session_data->status[IN_WHITEBOARD]) {
this->sendMessage(ALREADY_IN_SESSION, 0, "", requesterJID, false);
+ return;
}
// Check to see if the user made any modifications to this document. If so,
diff --git a/src/jabber_whiteboard/message-contexts.cpp b/src/jabber_whiteboard/message-contexts.cpp
index 1b5ea12fd..70983bad0 100644
--- a/src/jabber_whiteboard/message-contexts.cpp
+++ b/src/jabber_whiteboard/message-contexts.cpp
@@ -68,6 +68,11 @@ initialize_received_message_contexts(MessageContextMap& mcm)
// Message: CONNECT_REQUEST_USER
std::bitset< NUM_FLAGS > m5;
m5.set(LOGGED_IN);
+
+ // We should still _accept_ CONNECT_REQUEST_USER messages even if we're already
+ // waiting for a response. It is up to the higher-level handler (i.e. the connection
+ // request handler) to properly handle it.
+ m5.set(WAITING_FOR_INVITE_RESPONSE);
mcm[CONNECT_REQUEST_USER] = m5;
// Message: CONNECT_REQUEST_RESPONSE_USER
diff --git a/src/jabber_whiteboard/message-handler.cpp b/src/jabber_whiteboard/message-handler.cpp
index cdcef74b8..031ed7348 100644
--- a/src/jabber_whiteboard/message-handler.cpp
+++ b/src/jabber_whiteboard/message-handler.cpp
@@ -86,11 +86,10 @@ MessageHandler::_hasValidReceiveContext(LmMessage* message)
// TODO: remove this debug block
if ((status & recvcontext).to_ulong() < status.to_ulong()) {
- g_warning("Received message in incorrect context (current is not a subset of required); discarding message.");
+ g_warning("Received message in incorrect context; discarding message.");
std::string s2 = recvcontext.to_string< char, std::char_traits< char >, std::allocator< char > >();
-
g_warning("current context=%s required context=%s (msgtype %s)", s1.c_str(), s2.c_str(), MessageHandler::ink_type_to_string(type));
}