.rubocop.yml 🔗
@@ -61,7 +61,7 @@ Style/FormatString:
# Offense count: 1
Style/IfInsideElse:
Exclude:
- - 'sgx-catapult.rb'
+ - 'sgx-bwmsgsv2.rb'
Style/LeadingCommentSpace:
Enabled: false
Denver Gingerich created
.rubocop.yml | 2 +-
em_promise.rb | 8 ++++----
sgx-bwmsgsv2.rb | 46 +++++++++++++++++++++++-----------------------
3 files changed, 28 insertions(+), 28 deletions(-)
@@ -61,7 +61,7 @@ Style/FormatString:
# Offense count: 1
Style/IfInsideElse:
Exclude:
- - 'sgx-catapult.rb'
+ - 'sgx-bwmsgsv2.rb'
Style/LeadingCommentSpace:
Enabled: false
@@ -2,20 +2,20 @@
#
# Copyright (C) 2017 Stephen Paul Weber <singpolyma@singpolyma.net>
#
-# This file is part of sgx-catapult.
+# This file is part of sgx-bwmsgsv2.
#
-# sgx-catapult is free software: you can redistribute it and/or modify it under
+# sgx-bwmsgsv2 is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
-# sgx-catapult is distributed in the hope that it will be useful, but WITHOUT
+# sgx-bwmsgsv2 is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
-# with sgx-catapult. If not, see <http://www.gnu.org/licenses/>.
+# with sgx-bwmsgsv2. If not, see <http://www.gnu.org/licenses/>.
require "eventmachine"
require "promise"
@@ -3,20 +3,20 @@
# Copyright (C) 2017-2020 Denver Gingerich <denver@ossguy.com>
# Copyright (C) 2017 Stephen Paul Weber <singpolyma@singpolyma.net>
#
-# This file is part of sgx-catapult.
+# This file is part of sgx-bwmsgsv2.
#
-# sgx-catapult is free software: you can redistribute it and/or modify it under
+# sgx-bwmsgsv2 is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
-# sgx-catapult is distributed in the hope that it will be useful, but WITHOUT
+# sgx-bwmsgsv2 is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
-# with sgx-catapult. If not, see <http://www.gnu.org/licenses/>.
+# with sgx-bwmsgsv2. If not, see <http://www.gnu.org/licenses/>.
require 'blather/client/dsl'
require 'em-hiredis'
@@ -36,7 +36,7 @@ require_relative 'em_promise'
def panic(e)
puts "Shutting down gateway due to exception: #{e.message}"
puts e.backtrace
- SGXcatapult.shutdown
+ SGXbwmsgsv2.shutdown
puts 'Gateway has terminated.'
EM.stop
end
@@ -81,7 +81,7 @@ module CatapultSettingFlagBits
MMS_ON_OOB_URL = 1
end
-module SGXcatapult
+module SGXbwmsgsv2
extend Blather::DSL
@jingle_sids = {}
@@ -657,7 +657,7 @@ module SGXcatapult
end
iq '/iq/ns:query', ns: 'http://jabber.org/protocol/disco#info' do |i|
- # respond to capabilities request for an sgx-catapult number JID
+ # respond to capabilities request for an sgx-bwmsgsv2 number JID
if i.to.node
# TODO: confirm the node URL is expected using below
#puts "XR[node]: #{xpath_result[0]['node']}"
@@ -672,11 +672,11 @@ module SGXcatapult
next
end
- # respond to capabilities request for sgx-catapult itself
+ # respond to capabilities request for sgx-bwmsgsv2 itself
msg = i.reply
msg.node = i.node
msg.identities = [{
- name: 'Soprani.ca Gateway to XMPP - Catapult',
+ name: 'Soprani.ca Gateway to XMPP - Bandwidth API V2',
type: 'sms', category: 'gateway'
}]
msg.features = @gateway_features
@@ -839,7 +839,7 @@ module SGXcatapult
".\nUser Id is nick, API Token is username, "\
"API Secret is password, Phone Number is phone"\
".\n\nThe source code for this gateway is at "\
- "https://gitlab.com/ossguy/sgx-catapult ."\
+ "https://gitlab.com/soprani.ca/sgx-bwmsgsv2 ."\
"\nCopyright (C) 2017-2020 Denver Gingerich "\
"and others, licensed under AGPLv3+."
n2 = Nokogiri::XML::Node.new 'nick', msg.document
@@ -873,12 +873,12 @@ module SGXcatapult
}
]
x.title = 'Register for '\
- 'Soprani.ca Gateway to XMPP - Catapult'
+ 'Soprani.ca Gateway to XMPP - Bandwidth API V2'
x.instructions = "Enter the details from your Account "\
"page as well as the Phone Number\nin your "\
"account you want to use (ie. '+12345678901')"\
".\n\nThe source code for this gateway is at "\
- "https://gitlab.com/ossguy/sgx-catapult ."\
+ "https://gitlab.com/soprani.ca/sgx-bwmsgsv2 ."\
"\nCopyright (C) 2017-2020 Denver Gingerich "\
"and others, licensed under AGPLv3+."
msg.add_child(x)
@@ -976,9 +976,9 @@ class WebhookHandler < Goliath::API
bare_jid = REDIS.get(jid_key).promise.sync
if !bare_jid
- puts "jid_key (#{jid_key}) DNE; Catapult misconfigured?"
+ puts "jid_key (#{jid_key}) DNE; BW API misconfigured?"
- # TODO: likely not appropriate; give error to Catapult?
+ # TODO: likely not appropriate; give error to BW API?
# TODO: add text re credentials not being registered
#write_to_stream error_msg(m.reply, m.body, :auth,
# 'registration-required')
@@ -1000,7 +1000,7 @@ class WebhookHandler < Goliath::API
)
has_media = true
- SGXcatapult.send_media(
+ SGXbwmsgsv2.send_media(
others_num + '@' +
ARGV[0],
bare_jid, media_url
@@ -1031,7 +1031,7 @@ class WebhookHandler < Goliath::API
msg = Blather::Stanza::Message.new(
bare_jid, text)
msg.from = others_num + '@' + ARGV[0]
- SGXcatapult.write(msg)
+ SGXbwmsgsv2.write(msg)
end
return [200, {}, "OK"]
@@ -1092,13 +1092,13 @@ class WebhookHandler < Goliath::API
end
msg.from = others_num + '@' + ARGV[0]
- SGXcatapult.write(msg)
+ SGXbwmsgsv2.write(msg)
[200, {}, "OK"]
rescue Exception => e
puts 'Shutting down gateway due to exception 013: ' + e.message
- SGXcatapult.shutdown
+ SGXbwmsgsv2.shutdown
puts 'Gateway has terminated.'
EM.stop
end
@@ -1107,11 +1107,11 @@ end
at_exit do
$stdout.sync = true
- puts "Soprani.ca/SMS Gateway for XMPP - Catapult\n"\
+ puts "Soprani.ca/SMS Gateway for XMPP - Bandwidth API V2\n"\
"==>> last commit of this version is " + `git rev-parse HEAD` + "\n"
if ARGV.size != 7
- puts "Usage: sgx-catapult.rb <component_jid> "\
+ puts "Usage: sgx-bwmsgsv2.rb <component_jid> "\
"<component_password> <server_hostname> "\
"<server_port> <delivery_receipt_url> "\
"<http_listen_port> <mms_proxy_prefix_url>"
@@ -1124,13 +1124,13 @@ at_exit do
EM.run do
REDIS = EM::Hiredis.connect
- SGXcatapult.run
+ SGXbwmsgsv2.run
# required when using Prosody otherwise disconnects on 6-hour inactivity
EM.add_periodic_timer(3600) do
msg = Blather::Stanza::Iq::Ping.new(:get, 'localhost')
msg.from = ARGV[0]
- SGXcatapult.write(msg)
+ SGXbwmsgsv2.write(msg)
end
server = Goliath::Server.new('0.0.0.0', ARGV[5].to_i)
@@ -1144,7 +1144,7 @@ at_exit do
trap(sig) do
EM.defer do
puts 'Shutting down gateway...'
- SGXcatapult.shutdown
+ SGXbwmsgsv2.shutdown
puts 'Gateway has terminated.'
EM.stop