Software /
code /
verse
Comparison
plugins/jingle_s5b.lua @ 457:73d4eb93657b
Update to use util.id for random ids instead of counters (thanks Zash)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 16 Mar 2023 11:41:52 +0000 |
parent | 392:cdea6a28369e |
child | 490:6b2f31da9610 |
comparison
equal
deleted
inserted
replaced
456:6a65142052c8 | 457:73d4eb93657b |
---|---|
1 local verse = require "verse"; | 1 local verse = require "verse"; |
2 | 2 |
3 local xmlns_s5b = "urn:xmpp:jingle:transports:s5b:1"; | 3 local xmlns_s5b = "urn:xmpp:jingle:transports:s5b:1"; |
4 local xmlns_bytestreams = "http://jabber.org/protocol/bytestreams"; | 4 local xmlns_bytestreams = "http://jabber.org/protocol/bytestreams"; |
5 local sha1 = require "util.hashes".sha1; | 5 local sha1 = require "util.hashes".sha1; |
6 local uuid_generate = require "util.uuid".generate; | 6 local new_id = require "util.id".short; |
7 | 7 |
8 local function negotiate_socks5(conn, hash) | 8 local function negotiate_socks5(conn, hash) |
9 local function suppress_connected() | 9 local function suppress_connected() |
10 conn:unhook("connected", suppress_connected); | 10 conn:unhook("connected", suppress_connected); |
11 return true; | 11 return true; |
90 end, 10); | 90 end, 10); |
91 | 91 |
92 local s5b = {}; | 92 local s5b = {}; |
93 | 93 |
94 function s5b:generate_initiate() | 94 function s5b:generate_initiate() |
95 self.s5b_sid = uuid_generate(); | 95 self.s5b_sid = new_id(); |
96 local transport = verse.stanza("transport", { xmlns = xmlns_s5b, | 96 local transport = verse.stanza("transport", { xmlns = xmlns_s5b, |
97 mode = "tcp", sid = self.s5b_sid }); | 97 mode = "tcp", sid = self.s5b_sid }); |
98 local p = 0; | 98 local p = 0; |
99 for jid, streamhost in pairs(stream.proxy65.available_streamhosts) do | 99 for jid, streamhost in pairs(stream.proxy65.available_streamhosts) do |
100 p = p + 1; | 100 p = p + 1; |