すべての連絡先リスト アイテムの存在を更新する Google トーク リスナーを実装しています。
require 'xmpp4r'
require 'xmpp4r/roster'
require 'xmpp4r/roster/helper/roster'
sender_jid = Jabber::JID.new('email')
client = Jabber::Client.new(sender_jid)
client.connect('talk.google.com')
client.auth('password')
client.send(Jabber::Presence.new.set_type(':available'))
#Presence updates:
client.add_presence_callback do |pres|
puts pres.from.to_s.split("/")[0] unless pres.nil?
puts pres.show.to_s.inspect unless pres.nil?
end
Thread.stop
client.close
コードは正常に動作し、スレッドは 1 つの Gmail アカウントでリッスンし続けますが、いくつかの連絡先が表示された後にこのエラーが発生します。
client.rb:33:in `stop': deadlock detected (fatal)
from client.rb:33:in `<main>'
このエラーが表示される他のアカウントには、さまざまなステータスの連絡先が多数あります。なぜこれが起こっているのか理解できないようです。どんな助けでも素晴らしいでしょう。
ありがとう。