From 4866cdf737e7a91ad376326a58d877548e03f126 Mon Sep 17 00:00:00 2001 From: Christopher Vollick <0@psycoti.ca> Date: Fri, 17 Mar 2023 16:34:07 -0400 Subject: [PATCH] Move to New Blather Version with Better IDs This is currently just my branch, but we'll move to another commit after it gets merged. This commit makes it so session IDs and IQ IDs are unique rather than the current state where they're always blather01, blather02, etc. Given that we just start, run roughly the same commands, and then close it meant all of our sessions were predictably numbered, and so we were seeing some previous runs of the script picking up old sessions, etc. Not great! Also, at some point between whenever the last version was and now the API changed for handlers, so we have to do that now. If we don't, the commands just sit there and never respond. Bad. So this makes our extensions more inline with upstream's new API. --- Gemfile | 2 +- lib/blather_client.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 481e938ab6f846b195eac2cc5b6a137ea6e86358..1434dcd91915aa18af9fb265380c573ce9fe7ea1 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source "https://rubygems.org" gem "amazing_print" gem "bandwidth-sdk", "<= 6.1.0" -gem "blather", git: "https://github.com/adhearsion/blather", branch: "develop" +gem "blather", git: "https://github.com/psycotica0/blather", branch: "cv_new_id" gem "braintree" gem "dhall", ">= 0.5.3.fixed" gem "em-hiredis" diff --git a/lib/blather_client.rb b/lib/blather_client.rb index 6de5c2ddf899d9b9999f5ade86db6c335011eecc..29aec145b9e0a82b4644f6f6167a4d2e18efa1a8 100644 --- a/lib/blather_client.rb +++ b/lib/blather_client.rb @@ -59,7 +59,8 @@ class BlatherClient < Blather::Client found = stanza.find(*guards) handler.call(stanza, found) unless found.empty? else - handler.call(stanza) unless guarded?(guards, stanza) + throw :pass if guarded?(guards, stanza) + handler.call(stanza) end return result unless result.is_a?(Promise)