webXMPP

Check-in [04a597a22e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Merge branch 'master' of https://github.com/vandys/-webXMPP
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:04a597a22ee2997e2d480e41ab30823837a34cd18db06de58445f5631d8c8f06
User & Date: vandyswa@gmail.com 2017-06-30 05:09:18
Context
2017-07-01
00:01
Failed idea on dealing with NAT, back out. check-in: 0d418f5fb1 user: ajv-899-334-8894@vsta.org tags: master, trunk
00:00
Counterpart to protocol changes in chore/pong.py, we are now NAT/firewall friendly. check-in: 3ffad81c57 user: vandyswa@gmail.com tags: master, trunk
2017-06-30
05:09
Merge branch 'master' of https://github.com/vandys/-webXMPP check-in: 04a597a22e user: vandyswa@gmail.com tags: master, trunk
05:09
Bring up, -ting subop handling for NAT accomodation check-in: ec8f5ea505 user: vandyswa@gmail.com tags: master, trunk
05:07
Bringup, UDP PONG protocol check-in: ffdf7a93ca user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to README.md.

8
9
10
11
12
13
14




15
16
17
18
19
20
21
Support has been added for Chrome on Android.  Seems to work
very well!

Support has also been added for SMS via a VoIP provider.  The
API provided by flowroute.com is the initial one supported.
So you can chat through this web UI to both XMPP and SMS
peers.





------

This is a Python web server which connects one or more users
with one or more XMPP accounts.  It provides a user interface
via the web browser to send and receive XMPP messages to your
peers.  It uses Ajax/Javascript when available, but can operate







>
>
>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Support has been added for Chrome on Android.  Seems to work
very well!

Support has also been added for SMS via a VoIP provider.  The
API provided by flowroute.com is the initial one supported.
So you can chat through this web UI to both XMPP and SMS
peers.

In support of independent and open source platforms, this server
can also provide notifications over a JSON UDP protocol, "PONG"
(Packet Oriented, Next Gen).

------

This is a Python web server which connects one or more users
with one or more XMPP accounts.  It provides a user interface
via the web browser to send and receive XMPP messages to your
peers.  It uses Ajax/Javascript when available, but can operate

Changes to udp.py.

21
22
23
24
25
26
27

28
29
30
31
32
33
34
..
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
...
195
196
197
198
199
200
201









202
203
204
205
206
207
208
209
touched = None
accounts = {}
hashed = {}

# This is the PONG server, subclassed with our hooks for looking up
#  passwords
class Serve(pong.Server):

    def get_password(self, uname):
	global accounts
	return accounts.get(uname)

    # Lazy calculation of hashed password
    def get_hashed_password(self, uname):
	global accounts, hashed
................................................................................
	global TIMEOUT, accounts

	self.approot = approot
	TIMEOUT = cfg.get("timeout", 150)
	port = self.port = cfg["port"]
        self.conn = Serve(port)

	# Cache any UDP accounts
	for uname,d in approot.config["user"]:
	    if "password" not in d:
		continue
	    accounts[uname] = d["password"]

    # Operational parameters
    def handle_params(self, pak):
	inner = pak.inner
	subop = inner["subop"]

	# Tell them about the operation parameters
	if subop == "get":
................................................................................

	log(" unknown op: " + op)

    # This is the UDP port service loop.  It runs in its own
    #  thread, interacting with the rest of the server
    #  via self.approot
    def run(self):









	while True:

	    # Next request
            pak = self.conn.next_msg()
	    try:
		self.handle(pak)
	    except:
		log(" bad packet")







>







 







<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>








21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
..
73
74
75
76
77
78
79






80
81
82
83
84
85
86
...
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
touched = None
accounts = {}
hashed = {}

# This is the PONG server, subclassed with our hooks for looking up
#  passwords
class Serve(pong.Server):

    def get_password(self, uname):
	global accounts
	return accounts.get(uname)

    # Lazy calculation of hashed password
    def get_hashed_password(self, uname):
	global accounts, hashed
................................................................................
	global TIMEOUT, accounts

	self.approot = approot
	TIMEOUT = cfg.get("timeout", 150)
	port = self.port = cfg["port"]
        self.conn = Serve(port)







    # Operational parameters
    def handle_params(self, pak):
	inner = pak.inner
	subop = inner["subop"]

	# Tell them about the operation parameters
	if subop == "get":
................................................................................

	log(" unknown op: " + op)

    # This is the UDP port service loop.  It runs in its own
    #  thread, interacting with the rest of the server
    #  via self.approot
    def run(self):
	global accounts

	# Cache any UDP accounts; we're on our own thread, let
	#  the main one finish parsing the config file.
	for uname,d in self.approot.config["user"]:
	    for tup,d2 in d["account"]:
		if tup[0] == "pong":
		    accounts[uname] = tup[1]

	while True:

	    # Next request
            pak = self.conn.next_msg()
	    try:
		self.handle(pak)
	    except:
		log(" bad packet")

Changes to user.py.

93
94
95
96
97
98
99





100
101
102
103
104
105
106
			#  numbers so we can text them without
			#  waiting to get them in our history.
			for tup2 in cfg.get("sms", ()):
			    # tup2 = (Name, phone#)
			    phnum = acct_sms.normalize(tup2[1])
			    a.register(tup2[0], tup2[1])
			    self.roster["sms:" + tup2[0]] = a






		    # Checked in config during startup?
		    else:
			raise Exception, "Bad account: %r" % (tup,)

    # After the system sees us without a user long enough, it figures the
    #  user's gone away and tells us to clean up.







>
>
>
>
>







93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
			#  numbers so we can text them without
			#  waiting to get them in our history.
			for tup2 in cfg.get("sms", ()):
			    # tup2 = (Name, phone#)
			    phnum = acct_sms.normalize(tup2[1])
			    a.register(tup2[0], tup2[1])
			    self.roster["sms:" + tup2[0]] = a

		    # UDP PONG server password
		    elif typ == "pong":
			# Resolved by udp.py
			pass

		    # Checked in config during startup?
		    else:
			raise Exception, "Bad account: %r" % (tup,)

    # After the system sees us without a user long enough, it figures the
    #  user's gone away and tells us to clean up.