webXMPP

Check-in [ffdf7a93ca]
Login

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

Overview
Comment:Bringup, UDP PONG protocol
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:ffdf7a93ca76f8ad0e87309aec0b5a56d3bd7ded3fe94f483a3d6f49b4cb953f
User & Date: ajv-899-334-8894@vsta.org 2017-06-30 05:07:06
Context
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:07
Bringup, UDP PONG protocol check-in: ffdf7a93ca user: ajv-899-334-8894@vsta.org tags: master, trunk
00:27
Merge branch 'master' of https://github.com/vandys/-webXMPP check-in: 4d5a71d733 user: vandyswa@gmail.com 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
...
191
192
193
194
195
196
197









198
199
200
201
202
203
204
205
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 = approot.config["poll1"]
	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
...
186
187
188
189
190
191
192
193
194
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 = approot.config["poll1"]
	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.