Fixed some minor bugs -- the name of the incoming shared folder is parsed correctly, and xmppClient now catches bounce errors that were previously parsed as messages.

This commit is contained in:
jonathandicarlo@jonathan-dicarlos-macbook-pro.local 2008-06-13 16:20:43 -07:00
Родитель b25663858a
Коммит 351b7b4c82
3 изменённых файлов: 10 добавлений и 6 удалений

Просмотреть файл

@ -143,7 +143,7 @@ BookmarksEngine.prototype = {
*/
let words = messageText.split(" ");
let commandWord = words[0];
let directoryName = words[1];
let directoryName = words.slice(1).join(" ");
if ( commandWord == "share" ) {
bmkEngine._incomingShareOffer( directoryName, from );
} else if ( commandWord == "stop" ) {
@ -163,7 +163,6 @@ BookmarksEngine.prototype = {
self.done();
},
_incomingShareOffer: function BmkEngine__incomingShareOffer( dir, user ) {
/* Called when we receive an offer from another user to share a
directory.
@ -220,15 +219,17 @@ BookmarksEngine.prototype = {
/* Set the annotation on the folder so we know
it's an outgoing share: */
dump( "I'm in _share.\n" );
let folderItemId = selectedFolder.node.itemId;
let folderName = selectedFolder.getAttribute( "label" );
ans.setItemAnnotation(folderItemId, OUTGOING_SHARED_ANNO, username, 0,
ans.EXPIRE_NEVER);
// TODO: does this clobber existing annotations?
dump( "I set the annotation...\n" );
// Send an xmpp message to the share-ee
if ( this._xmppClient ) {
if ( this._xmppClient._connectionStatus == this._xmppClient.CONNECTED ) {
dump( "Gonna send notification...\n" );
let msgText = "share " + folderName;
this._xmppClient.sendMessage( username, msgText );
} else {

Просмотреть файл

@ -673,6 +673,7 @@ WeaveSvc.prototype = {
"share-bookmarks" will be sent out to any observers who are listening
for it. As far as I know, there aren't currently any listeners for
"share-bookmarks" but we'll send it out just in case. */
dump( "This fails with an Exception: cannot aquire internal lock.\n" );
this._lock(this._notify(messageName,
this._shareData,
dataType,

Просмотреть файл

@ -134,17 +134,19 @@ XmppClient.prototype = {
}
// Message is parseable, now look for message-level errors.
var rootElem = responseDOM.documentElement;
var errors = rootElem.getElementsByTagName( "stream:error" );
if ( errors.length > 0 ) {
this.setError( errors[0].firstChild.nodeName );
return;
}
errors = rootElem.getElementsByTagName( "error" );
if ( errors.length > 0 ) {
this.setError( errors[0].firstChild.nodeName );
return;
}
// Stream is valid.
// Detect and handle mid-authentication steps.
if ( this._connectionStatus == this.CALLED_SERVER ) {
// skip TLS, go straight to SALS. (encryption should be negotiated