pax_global_header 0000666 0000000 0000000 00000000064 13200175733 0014513 g ustar 00root root 0000000 0000000 52 comment=ad6541fe7b2514569a3b34795def2a738631d516
strophejs-1.2.14+dfsg/ 0000775 0000000 0000000 00000000000 13200175733 0014540 5 ustar 00root root 0000000 0000000 strophejs-1.2.14+dfsg/.gitattributes 0000664 0000000 0000000 00000000017 13200175733 0017431 0 ustar 00root root 0000000 0000000 *.min.js binary strophejs-1.2.14+dfsg/.travis.yml 0000664 0000000 0000000 00000000070 13200175733 0016646 0 ustar 00root root 0000000 0000000 language: node_js
node_js:
- "0.10"
script: make check
strophejs-1.2.14+dfsg/CHANGELOG.md 0000664 0000000 0000000 00000017616 13200175733 0016364 0 ustar 00root root 0000000 0000000 # Strophe.js Change Log
## Version 1.2.14 - 2017-06-15
* #231 SASL OAuth Bearer authentication should not require a JID node, when a user identifer
can be retreived from the bearer token.
* #250 Show XHR error message
* #254 Set connection status to CONNFAIL after max retries
* #255 Set CONNFAIL error status when connection fails on Safari 10
## Version 1.2.13 - 2017-02-25
* Use almond to create the build. This means that the build itself is an AMD
module and can be loaded via `require`.
* Remove Grunt as a build tool.
## Version 1.2.12 - 2017-01-15
* Reduce the priority of the SASL-EXTERNAL auth mechanism. OpenFire 4.1.1
advertises support for SASL-EXTERNAL and the vast majority of Strophe.js
installs are not set up to support SASL-EXTERNAl, causing them to fail
logging users in.
## Version 1.2.11 - 2016-12-13
* 189 Strophe never reaches DISCONNECTED status after .connect(..) and
.disconnect(..) calls while offline.
* Add `sendPresence` method, similar to `sendIQ`, i.e. for cases where you expect a
responding presence (e.g. when leaving a MUC room).
## Version 1.2.10 - 2016-11-30
* #172 and #215: Strophe shouldn't require `from` attribute in iq response
* #216 Get inactivity attribute from session creation response
* Enable session restoration for anonymous logins
## Version 1.2.9 - 2016-10-24
* Allow SASL mechanisms to be supported to be passed in as option to `Strophe.Connection` constructor.
* Add new matching option to `Strophe.Handler`, namely `ignoreNamespaceFragment`.
* The `matchBare` matching option for `Strophe.Handler` has been renamed to
`matchBareFromJid`. The old name will still work in this release but is
deprecated and will be removed in a future release.
* #114 Add an error handler for HTTP calls
* #213 "XHR open failed." in BOSH in IE9
* #214 Add function to move Strophe.Builder pointer back to the root node
* #172, #215 Don't compare `to` and `to` values of sent and received IQ stanzas
to determine correctness (we rely on UUIDs for that).
## Version 1.2.8 - 2016-09-16
* #200 Fix for webpack
* #203 Allow custom Content-Type header for requests
* #206 XML stanza attributes: there is no 'quot' escape inside 'serialize' method
* The files in `./src` are now also included in the NPM distribution.
* Add support for SASL-EXTERNAL
## Version 1.2.7 - 2016-06-17
* #193 Move phantomjs dependencies to devDependencies
## Version 1.2.6 - 2016-06-06
* #178 Added new value (CONNTIMEOUT) to Strophe.Status
* #180 bosh: check sessionStorage support before using it
* #182 Adding SASL OAuth Bearer authentication
* #190 Fix .c() to accept both text and numbers as text for the child element
* #192 User requirejs instead of require for node compat
## Version 1.2.5 - 2016-02-09
* Add a new Strophe.Connection option to add cookies
* Add new Strophe.Connection option "withCredentials"
## Version 1.2.4 - 2016-01-28
* #147 Support for UTF-16 encoded usernames (e.g. Chinese)
* #162 allow empty expectedFrom according to W3C DOM 3 Specification
* #171 Improve invalid BOSH URL handling
## Version 1.2.3 - 2015-09-01
* Bugfix. Check if JID is null when restoring a session.
* #127 IE-Fix: error on setting null value with setAttributes
* #138 New stub method nextValidRid
* #144 Change ID generator to generate UUIDs
## Version 1.2.2 - 2015-06-20
* #109 Explicitly define AMD modules to prevent errors with AlmondJS and AngularJS.
* #111 Fixed IE9 compatibility.
* #113 Permit connecting with an alternative authcid.
* #116 tree.attrs() now removes Elements when they are set to undefined
* #119 Provide the 'keepalive' option to keep a BOSH session alive across page loads.
* #121 Ensure that the node names of HTML elements copied into XHTML are lower case.
* #124 Strophe's Builder will swallow elements if given a blank string as a 'text' parameter.
## Version 1.2.1 - 2015-02-22
* Rerelease of 1.2.0 but with a semver tag and proper formatting of bower.json
for usage with Bower.io.
## Version 1.2.0 - 2015-02-21
* Add bower package manager support.
* Add commandline testing support via qunit-phantomjs-runner
* Add integrated testing via TravisCI.
* Fix Websocket connections now use the current XMPP-over-WebSockets RFC
* #25 Item-not-found-error caused by long term request.
* #29 Add support for the Asynchronous Module Definition (AMD) and require.js
* #30 Base64 encoding problem in some older browsers.
* #45 Move xhlr plugin to strophejs-plugins repo.
* #60 Fixed deletion of handlers in websocket connections
* #62 Add `xmlunescape` method.
* #67 Use correct Content-Type in BOSH
* #70 `_onDisconnectTimeout` never tiggers because maxRetries is undefined.
* #71 switched to case sensitive handling of XML elements
* #73 `getElementsByTagName` problem with namespaced elements.
* #76 respect "Invalid SID" message
* #79 connect.pause work correctly again
* #90 The queue data was not reset in .reset() method.
* #104 Websocket connections with MongooseIM work now
## Version 1.1.3 - 2014-01-20
* Fix SCRAM-SHA1 auth now works for multiple connections at the same time
* Fix Connecting to a different server with the same connection after disconnect
* Add Gruntfile so StropheJS can now also be built using grunt
* Fix change in sha1.js that broke the caps plugin
* Fix all warnings from jshint.
## Version 1.1.2 - 2014-01-04
* Add option for synchronous BOSH connections
* moved bower.json to other repository
* Remove unused code in sha1 and md5 modules
## Version 1.1.1 - 2013-12-16
* Fix BOSH attach is working again
## Version 1.1.0 - 2013-12-11
* Add Support for XMPP-over-WebSocket
* Authentication mechanisms are now modular and can be toggled
* Transport protocols are now modular and will be chosen based on the
connection URL. Currently supported protocols are BOSH and WebSocket
* Add Strings to some disconnects that indicate the reason
* Add option to strip
tags before passing to xmlInput/xmlOutput
* Fix Connection status staying at CONNFAIL or CONNECTING in certain
error scenarios
* Add package.json for use with npm
* Add bower.json for use with bower
* Fix handlers not being removed after disconnect
* Fix legacy non-sasl authentication
* Add better tests for BOSH bind
* Fix use of deprecated functions in tests
* Remove some dead code
* Remove deprecated documentation
* Fix Memory leak in IE9
* Add An options object can be passed to a Connection constructor now
* Add "Route" Parameter for BOSH Connections
* Add Maximum number of connection attempts before disconnecting
* Add conflict condition for AUTHFAIL
* Add XHTML message support
* Fix parsing chat messages in IE
* Add SCRAM-SHA-1 SASL mechanism
* Fix escaping of messages
## Version 1.0.2 - 2011-06-19
* Fix security bug where DIGEST-MD5 client nonce was not properly
randomized.
* Fix double escaping in copyElement.
* Fix IE errors related to importNode.
* Add ability to pass text into Builder.c().
* Improve performance by skipping debugging callbacks when not
overridden.
* Wrap handler runs in try/catch so they don't affect or remove later
handlers.
* Add ' and " to escaped characters and other escaping fixes.
* Fix _throttledRequestHandler to use proper window size.
* Fix timed handler management.
* Fix flXHR plugin to better deal with errors.
* Fix bind() to be ECMAScript 5 compatible.
* Use bosh.metajack.im in examples so they work out of the box.
* Add simple XHR tests.
* Update basic example to HTML5.
* Move community plugins to their own repository.
* Fix bug causing infinite retries.
* Fix 5xx error handling.
* Store stream:features for later use by plugins.
* Fix to prevent passing stanzas during disconnect.
* Fix handling of disconnect responses.
* Fix getBareJidFromJid to return null on error.
* Fix equality testing in matchers so that string literals and string
objects both match.
* Fix bare matching on missing from attributes.
* Remove use of reserved word self.
* Fix various documentation errors.
## Version 1.0.1 - 2010-01-27
* Fix handling of window, hold, and wait attributes. Bug #75.
## Version 1.0 - 2010-01-01
* First release.
strophejs-1.2.14+dfsg/LICENSE.txt 0000664 0000000 0000000 00000002047 13200175733 0016366 0 ustar 00root root 0000000 0000000 Copyright (c) 2006-2009 Collecta, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
strophejs-1.2.14+dfsg/Makefile 0000664 0000000 0000000 00000005077 13200175733 0016211 0 ustar 00root root 0000000 0000000 BOWER ?= node_modules/.bin/bower
HTTPSERVE ?= ./node_modules/.bin/http-server
JSHINT ?= ./node_modules/.bin/jshint
PHANTOMJS ?= ./node_modules/.bin/phantomjs
RJS ?= ./node_modules/.bin/r.js
SHELL ?= /usr/env/bin/bash
SRC_DIR = src
DOC_DIR = doc
DOC_TEMP = doc-temp
NDPROJ_DIR = ndproj
SED ?= sed
STROPHE = strophe.js
STROPHE_MIN = strophe.min.js
STROPHE_LIGHT = strophe-no-polyfill.js
all: doc $(STROPHE) $(STROPHE_MIN)
.PHONY: help
help:
@echo "Please use \`make ' where is one of the following:"
@echo ""
@echo " release Prepare a new release of strophe.js. E.g. `make release VERSION=1.2.14`"
@echo " serve Serve this directory via a webserver on port 8000."
@echo " stamp-npm Install NPM dependencies and create the guard file stamp-npm which will prevent those dependencies from being installed again."
stamp-npm: package.json
npm install
touch stamp-npm
.PHONY: doc
doc:
@@echo "Building Strophe documentation..."
@@if [ ! -d $(NDPROJ_DIR) ]; then mkdir $(NDPROJ_DIR); fi
@@cp docs.css $(NDPROJ_DIR);
@@if [ ! -d $(DOC_DIR) ]; then mkdir $(DOC_DIR); fi
@@if [ ! -d $(DOC_TEMP) ]; then mkdir $(DOC_TEMP); fi
@@cp $(STROPHE) $(DOC_TEMP)
@@naturaldocs -r -ro -q -i $(DOC_TEMP) -o html $(DOC_DIR) -p $(NDPROJ_DIR) -s docs
@@rm -r $(DOC_TEMP)
@@echo "Documentation built."
@@echo
.PHONY: release
release:
$(SED) -i 's/\"version\":\ \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/\"version\":\ \"$(VERSION)\"/' package.json
$(SED) -i "s/Unreleased/`date +%Y-%m-%d`/" CHANGELOG.md
make dist
make doc
.PHONE: dist
dist: $(STROPHE) $(STROPHE_MIN) $(STROPHE_LIGHT)
$(STROPHE_MIN): src node_modules Makefile
$(RJS) -o build.js insertRequire=strophe-polyfill include=strophe-polyfill out=$(STROPHE_MIN)
$(SED) -i s/@VERSION@/$(VERSION)/ $(STROPHE_MIN)
$(STROPHE): src node_modules Makefile
$(RJS) -o build.js optimize=none insertRequire=strophe-polyfill include=strophe-polyfill out=$(STROPHE)
$(SED) -i s/@VERSION@/$(VERSION)/ $(STROPHE)
$(STROPHE_LIGHT): src node_modules Makefile
$(RJS) -o build.js optimize=none out=$(STROPHE_LIGHT)
$(SED) -i s/@VERSION@/$(VERSION)/ $(STROPHE_LIGHT)
.PHONY: jshint
jshint: stamp-npm
$(JSHINT) --config jshintrc src/*.js
.PHONY: check
check:: stamp-npm jshint
$(PHANTOMJS) node_modules/qunit-phantomjs-runner/runner-list.js tests/index.html
.PHONY: serve
serve:
$(HTTPSERVE) -p 8080
.PHONY: clean
clean:
@@rm -f stamp-npm
@@rm -rf node_modules
@@rm -f $(STROPHE)
@@rm -f $(STROPHE_MIN)
@@rm -f $(STROPHE_LIGHT)
@@rm -f $(PLUGIN_FILES_MIN)
@@rm -rf $(NDPROJ_DIR) $(DOC_DIR) $(DOC_TEMP)
@@echo "Done."
@@echo
strophejs-1.2.14+dfsg/README.md 0000664 0000000 0000000 00000003266 13200175733 0016026 0 ustar 00root root 0000000 0000000 # Strophe.js
[](https://travis-ci.org/strophe/strophejs)
Strophe.js is a JavaScript library for speaking XMPP via BOSH
([XEP 124](http://xmpp.org/extensions/xep-0124.html)
and [XEP 206](http://xmpp.org/extensions/xep-0206.html)) and WebSockets
([RFC 7395](http://tools.ietf.org/html/rfc7395)).
Its primary purpose is to enable web-based, real-time XMPP applications that
run in any browser.
The book [Professional XMPP Programming with JavaScript and jQuery](http://professionalxmpp.com)
covers Strophe in detail in the context of web applications.
## Quick Links
* [Homepage](http://strophe.im/strophejs)
* [Documentation](http://strophe.im/strophejs/doc/1.2.9/files/strophe-js.html)
* [Mailing list](http://groups.google.com/group/strophe)
* [Community Plugins](http://github.com/strophe/strophejs-plugins)
## Browser support
It has been tested on Firefox, Firefox for Android, IE, Safari, Mobile Safari,
Chrome, Chrome for Android, Opera and the mobile Opera browser.
## Running tests
You'll need to have [GNU Make](https://www.gnu.org/software/make/) available.
Then, simply run `make check` to run the tests.
## License
It is licensed under the [MIT license](https://github.com/strophe/strophejs/raw/master/LICENSE.txt),
except for the files sha1.js, base64.js and md5.js, which are licensed as public domain and BSD (see these files for details).
## Author & History
Strophe.js was originally created by Jack Moffitt. It was originally developed
for Chesspark, an online chess community based on XMPP technology. It has been
cared for and improved over the years and is currently maintained by many
people in the community.
strophejs-1.2.14+dfsg/RELEASE_CHECKLIST.md 0000664 0000000 0000000 00000001006 13200175733 0017530 0 ustar 00root root 0000000 0000000 # Release Checklist
1. Make sure all tests pass (run 'make check')
2. Update CHANGELOG.md
3. Run "make release VERSION=1.2.14" (on Mac, prefix with "SED=gsed" so that
GNU-sed is used).
4. Commit the newly generated files (mention it's a new release)
5. Tag code with version (git tag -s vVERSION )
6. Push repo and tags (git push && git push --tags)
7. Publish on NPM: "npm publish"
8. Add documentation to strophe.im repo
9. Update links in index.markdown in Strophe.im
10. Update link to documentation in README
strophejs-1.2.14+dfsg/build.js 0000664 0000000 0000000 00000000323 13200175733 0016173 0 ustar 00root root 0000000 0000000 ({
baseUrl: ".",
name: "node_modules/almond/almond.js",
mainConfigFile: "main.js",
include: ["strophe"],
wrap: {
startFile: "src/start.frag",
endFile: "src/end.frag"
}
})
strophejs-1.2.14+dfsg/contrib/ 0000775 0000000 0000000 00000000000 13200175733 0016200 5 ustar 00root root 0000000 0000000 strophejs-1.2.14+dfsg/contrib/discojs/ 0000775 0000000 0000000 00000000000 13200175733 0017636 5 ustar 00root root 0000000 0000000 strophejs-1.2.14+dfsg/contrib/discojs/README.txt 0000664 0000000 0000000 00000002442 13200175733 0021336 0 ustar 00root root 0000000 0000000 Disco Dancing with XMPP
There are many things one can do via XMPP. The list is
endlist. But one thing that some forget about is discovering
services a XMPP entity or server provides. In most cases a human or
user does not care about this information and should not care. But
you may have a website or web application that needs this
information in order to decide what options to show to your
users. You can do this very easily with JQuery, Strophe, and
Punjab.
We start with Punjab or a BOSH connection manager. This is
needed so we can connect to a XMPP server. First, lets download
punjab.
svn co https://code.stanziq.com/svn/punjab/trunk punjab
After we have punjab go into the directory and install punjab.
cd punjab
python setup.py install
Then create a .tac file to configure Punjab.
See punjab.tac
Next, we will need Strophe. Lets download thelatest version from
svn too.
cd /directory/where/you/configured/punjab/html
svn co https://code.stanziq.com/svn/strophe/trunk/strophejs
In your html directory you will then begin to create your disco browser.
Version 1 we take the basic example and modify it to do disco.
Version 2 we add anonymous login
Version 3 we make it pretty
Version 4 we add handlers for different services
strophejs-1.2.14+dfsg/contrib/discojs/css/ 0000775 0000000 0000000 00000000000 13200175733 0020426 5 ustar 00root root 0000000 0000000 strophejs-1.2.14+dfsg/contrib/discojs/css/disco.css 0000664 0000000 0000000 00000000230 13200175733 0022234 0 ustar 00root root 0000000 0000000 #login .leftinput
{
margin-bottom: .5em;
}
#login input
{
margin-bottom: 10px;
}
#log {
width: 100%;
height: 200px;
overflow: auto;
}
strophejs-1.2.14+dfsg/contrib/discojs/index.html 0000664 0000000 0000000 00000002720 13200175733 0021634 0 ustar 00root root 0000000 0000000
XMPP Disco Dancing
strophejs-1.2.14+dfsg/examples/attach/ 0000775 0000000 0000000 00000000000 13200175733 0017622 5 ustar 00root root 0000000 0000000 strophejs-1.2.14+dfsg/examples/attach/README 0000664 0000000 0000000 00000002317 13200175733 0020505 0 ustar 00root root 0000000 0000000 This is an example of Strophe attaching to a pre-existing BOSH session
that is created externally. This example requires a bit more than
HTML and JavaScript. Specifically it contains a very simple Web
application written in Django which creates a BOSH session before
rendering the page.
Requirements:
* Django 1.0 (http://www.djangoproject.com)
* Twisted 8.1.x (http://twistedmatrix.com)
* Punjab 0.3 (http://code.stanziq.com/punjab)
Note that Twisted and Punjab are only used for small functions related
to JID and BOSH parsing.
How It Works:
The Django app contains one view which is tied to the root URL. This
view uses the BOSHClient class to start a BOSH session using the
settings from settings.py.
Once the connection is established, Django passes the JID, SID, and
RID for the BOSH session into the template engine and renders the
page.
The template assigns the JID, SID, and RID to global vars like so:
var BOSH_JID = {{ jid }};
var BOSH_SID = {{ sid }};
var BOSH_RID = {{ rid }};
The connection is attached to Strophe by calling
Strophe.Connection.attach() with this data and a connection callback
handler.
To show that the session is attached and works, a disco info ping is
done to jabber.org.
strophejs-1.2.14+dfsg/examples/attach/__init__.py 0000664 0000000 0000000 00000000000 13200175733 0021721 0 ustar 00root root 0000000 0000000 strophejs-1.2.14+dfsg/examples/attach/attacher/ 0000775 0000000 0000000 00000000000 13200175733 0021415 5 ustar 00root root 0000000 0000000 strophejs-1.2.14+dfsg/examples/attach/attacher/__init__.py 0000664 0000000 0000000 00000000000 13200175733 0023514 0 ustar 00root root 0000000 0000000 strophejs-1.2.14+dfsg/examples/attach/attacher/views.py 0000664 0000000 0000000 00000000733 13200175733 0023127 0 ustar 00root root 0000000 0000000 from django.http import HttpResponse
from django.template import Context, loader
from attach.settings import BOSH_SERVICE, JABBERID, PASSWORD
from attach.boshclient import BOSHClient
def index(request):
bc = BOSHClient(JABBERID, PASSWORD, BOSH_SERVICE)
bc.startSessionAndAuth()
t = loader.get_template("attacher/index.html")
c = Context({
'jid': bc.jabberid.full(),
'sid': bc.sid,
'rid': bc.rid,
})
return HttpResponse(t.render(c))
strophejs-1.2.14+dfsg/examples/attach/boshclient.py 0000664 0000000 0000000 00000012266 13200175733 0022335 0 ustar 00root root 0000000 0000000 import sys, os
import httplib, urllib
import random, binascii
from urlparse import urlparse
from punjab.httpb import HttpbParse
from twisted.words.xish import domish
from twisted.words.protocols.jabber import jid
TLS_XMLNS = 'urn:ietf:params:xml:ns:xmpp-tls'
SASL_XMLNS = 'urn:ietf:params:xml:ns:xmpp-sasl'
BIND_XMLNS = 'urn:ietf:params:xml:ns:xmpp-bind'
SESSION_XMLNS = 'urn:ietf:params:xml:ns:xmpp-session'
class BOSHClient:
def __init__(self, jabberid, password, bosh_service):
self.rid = random.randint(0, 10000000)
self.jabberid = jid.internJID(jabberid)
self.password = password
self.authid = None
self.sid = None
self.logged_in = False
self.headers = {"Content-type": "text/xml",
"Accept": "text/xml"}
self.bosh_service = urlparse(bosh_service)
def buildBody(self, child=None):
"""Build a BOSH body.
"""
body = domish.Element(("http://jabber.org/protocol/httpbind", "body"))
body['content'] = 'text/xml; charset=utf-8'
self.rid = self.rid + 1
body['rid'] = str(self.rid)
body['sid'] = str(self.sid)
body['xml:lang'] = 'en'
if child is not None:
body.addChild(child)
return body
def sendBody(self, body):
"""Send the body.
"""
parser = HttpbParse(True)
# start new session
conn = httplib.HTTPConnection(self.bosh_service.netloc)
conn.request("POST", self.bosh_service.path,
body.toXml(), self.headers)
response = conn.getresponse()
data = ''
if response.status == 200:
data = response.read()
conn.close()
return parser.parse(data)
def startSessionAndAuth(self, hold='1', wait='70'):
# Create a session
# create body
body = domish.Element(("http://jabber.org/protocol/httpbind", "body"))
body['content'] = 'text/xml; charset=utf-8'
body['hold'] = hold
body['rid'] = str(self.rid)
body['to'] = self.jabberid.host
body['wait'] = wait
body['window'] = '5'
body['xml:lang'] = 'en'
retb, elems = self.sendBody(body)
if type(retb) != str and retb.hasAttribute('authid') and \
retb.hasAttribute('sid'):
self.authid = retb['authid']
self.sid = retb['sid']
# go ahead and auth
auth = domish.Element((SASL_XMLNS, 'auth'))
auth['mechanism'] = 'PLAIN'
# TODO: add authzid
if auth['mechanism'] == 'PLAIN':
auth_str = ""
auth_str += "\000"
auth_str += self.jabberid.user.encode('utf-8')
auth_str += "\000"
try:
auth_str += self.password.encode('utf-8').strip()
except UnicodeDecodeError:
auth_str += self.password.decode('latin1') \
.encode('utf-8').strip()
auth.addContent(binascii.b2a_base64(auth_str))
retb, elems = self.sendBody(self.buildBody(auth))
if len(elems) == 0:
# poll for data
retb, elems = self.sendBody(self.buildBody())
if len(elems) > 0:
if elems[0].name == 'success':
retb, elems = self.sendBody(self.buildBody())
has_bind = False
for child in elems[0].children:
if child.name == 'bind':
has_bind = True
break
if has_bind:
iq = domish.Element(('jabber:client', 'iq'))
iq['type'] = 'set'
iq.addUniqueId()
iq.addElement('bind')
iq.bind['xmlns'] = BIND_XMLNS
if self.jabberid.resource:
iq.bind.addElement('resource')
iq.bind.resource.addContent(
self.jabberid.resource)
retb, elems = self.sendBody(self.buildBody(iq))
if type(retb) != str and retb.name == 'body':
# send session
iq = domish.Element(('jabber:client', 'iq'))
iq['type'] = 'set'
iq.addUniqueId()
iq.addElement('session')
iq.session['xmlns'] = SESSION_XMLNS
retb, elems = self.sendBody(self.buildBody(iq))
# did not bind, TODO - add a retry?
if type(retb) != str and retb.name == 'body':
self.logged_in = True
# bump up the rid, punjab already
# received self.rid
self.rid += 1
if __name__ == '__main__':
USERNAME = sys.argv[1]
PASSWORD = sys.argv[2]
SERVICE = sys.argv[3]
c = BOSHClient(USERNAME, PASSWORD, SERVICE)
c.startSessionAndAuth()
print c.logged_in
strophejs-1.2.14+dfsg/examples/attach/manage.py 0000775 0000000 0000000 00000001042 13200175733 0021424 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
sys.exit(1)
if __name__ == "__main__":
execute_manager(settings)
strophejs-1.2.14+dfsg/examples/attach/settings.py 0000664 0000000 0000000 00000005544 13200175733 0022044 0 ustar 00root root 0000000 0000000 # Django settings for attach project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Some Body', 'romeo@example.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '/path/to/attach.db' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Denver'
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = ''
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = ''
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'asdf'
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source',
# 'django.template.loaders.eggs.load_template_source',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
)
ROOT_URLCONF = 'attach.urls'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'/path/to/attach/templates',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'attach.attacher',
)
BOSH_SERVICE = 'http://example.com/xmpp-httpbind'
JABBERID = 'romeo@example.com/bosh'
PASSWORD = 'juliet.is.hawt'
strophejs-1.2.14+dfsg/examples/attach/templates/ 0000775 0000000 0000000 00000000000 13200175733 0021620 5 ustar 00root root 0000000 0000000 strophejs-1.2.14+dfsg/examples/attach/templates/attacher/ 0000775 0000000 0000000 00000000000 13200175733 0023413 5 ustar 00root root 0000000 0000000 strophejs-1.2.14+dfsg/examples/attach/templates/attacher/index.html 0000664 0000000 0000000 00000005442 13200175733 0025415 0 ustar 00root root 0000000 0000000
Strophe Attach Example
Strophe Attach Example
This example shows how to attach to an existing BOSH session with
Strophe.