webXMPP

Check-in [49fc248b90]
Login

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

Overview
Comment:Don't needlessly rev roster for SMS incoming. Field XMPP and add to roster if needed. In support of jmp.chat routed SMS.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256: 49fc248b90c45a7402e99961fc9640e643d662e0d086488f434e6d10c8e57f9e
User & Date: web 2019-12-07 17:47:13
Context
2019-12-07
23:07
Tidy up "extras" report check-in: 719d4d912c user: web tags: master, trunk
17:47
Don't needlessly rev roster for SMS incoming. Field XMPP and add to roster if needed. In support of jmp.chat routed SMS. check-in: 49fc248b90 user: web tags: master, trunk
17:25
A little debug help on our UDP proto when we hit an exception check-in: cb9a7146c6 user: web tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to acct_sms.py.

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

120
121
122
123
124
125
126
127
    phnum = fromwhom = msg.get("from")
    if not fromwhom:
	sys.stderr.write("Bad SMS with no sender: %s\n" % (msg,))
	return;

    # We're going to generate a new message
    u = a.user
    u.rgen += 1

    # If we have a nickname, use it
    if fromwhom in a.rbuddies:
	fromwhom = "sms:" + a.rbuddies[fromwhom]
	sys.stderr.write(" %s has nick %s\n" % (phnum, fromwhom))
    else:
	# No nickname, so learn this onto our roster
	if phnum not in u.roster:
	    sys.stderr.write(" learn %s on %s\n" % (a, phnum))
	    u.roster[phnum] = a


    # A message *to* us, from an SMS account
    sys.stderr.write(" post to user\n")
    u.add(True, fromwhom, msg["body"],
	msg.get("mtype"), msg.get("fname"))

    sys.stderr.write(" delivered\n")








<










>








102
103
104
105
106
107
108

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
    phnum = fromwhom = msg.get("from")
    if not fromwhom:
	sys.stderr.write("Bad SMS with no sender: %s\n" % (msg,))
	return;

    # We're going to generate a new message
    u = a.user


    # If we have a nickname, use it
    if fromwhom in a.rbuddies:
	fromwhom = "sms:" + a.rbuddies[fromwhom]
	sys.stderr.write(" %s has nick %s\n" % (phnum, fromwhom))
    else:
	# No nickname, so learn this onto our roster
	if phnum not in u.roster:
	    sys.stderr.write(" learn %s on %s\n" % (a, phnum))
	    u.roster[phnum] = a
	    u.rgen += 1

    # A message *to* us, from an SMS account
    sys.stderr.write(" post to user\n")
    u.add(True, fromwhom, msg["body"],
	msg.get("mtype"), msg.get("fname"))

    sys.stderr.write(" delivered\n")

Changes to acct_xmpp.py.

43
44
45
46
47
48
49

50







51
52
53
54
55
56
57
	if m is None:
	    # No data; typing, paused, etc.
	    return
	body  = toascii(m)
	sys.stderr.write("Message received from %s for %s\n" %
	    (sender, self.acct))
	sys.stderr.write("  Body: %s\n" % (body,))

	self.user.add(True, aname(sender), toascii(body), None, None)








    # Stop this Account; the user has gone away
    # We close off XMPP; the thread should come out of its loop
    #  and exit()
    def stop(self, tid):
	self.stopping = True








>
|
>
>
>
>
>
>
>







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
	if m is None:
	    # No data; typing, paused, etc.
	    return
	body  = toascii(m)
	sys.stderr.write("Message received from %s for %s\n" %
	    (sender, self.acct))
	sys.stderr.write("  Body: %s\n" % (body,))
	u = self.user
	u.add(True, aname(sender), toascii(body), None, None)

	# Learn into roster?
	if sender not in u.roster:
	    email = str(sender.node) + '@' + str(sender.domain)
	    sys.stderr.write("Add XMPP roster: %s\n" % (email,))
	    u.roster[email] = self
	    u.rgen += 1

    # Stop this Account; the user has gone away
    # We close off XMPP; the thread should come out of its loop
    #  and exit()
    def stop(self, tid):
	self.stopping = True