diff --git a/sgx-bwmsgsv2.rb b/sgx-bwmsgsv2.rb index 8f48652bb8151e3e2d87f493187d65ba0c4639f7..1aba0c99c2f24fb10fc3b17520f7812ee367bd3a 100755 --- a/sgx-bwmsgsv2.rb +++ b/sgx-bwmsgsv2.rb @@ -937,8 +937,9 @@ class WebhookHandler < Goliath::API id = WEBrick::HTTPUtils.unescape(tag_parts[0]) resourcepart = WEBrick::HTTPUtils.unescape(tag_parts[1]) - case jparams['deliveryState'] + case type when 'not-delivered' + # TODO: update above label # create a bare message like the one user sent msg = Blather::Stanza::Message.new( others_num + '@' + ARGV[0]) @@ -951,7 +952,7 @@ class WebhookHandler < Goliath::API 'recipient-unavailable', :wait ).to_node - when 'delivered' + when 'message-delivered' msg = ReceiptMessage.new(bare_jid) # TODO: put in member/instance variable @@ -965,14 +966,18 @@ class WebhookHandler < Goliath::API rcvd['xmlns'] = 'urn:xmpp:receipts' rcvd['id'] = id msg.add_child(rcvd) + + # TODO: make prettier: this should be done above + others_num = params['_json'][0]['to'] when 'waiting' + # TODO: update above label # can't really do anything with it; nice to know puts "message with id #{id} waiting" return [200, {}, "OK"] else # TODO: notify somehow of unknown state receivd? puts "message with id #{id} has "\ - "othr state #{jparams['deliveryState']}" + "other type #{type}" return [200, {}, "OK"] end