Class: Hipbot::Adapters::XMPP
- Inherits:
-
Object
- Object
- Hipbot::Adapters::XMPP
- Includes:
- Hipbot::Adaptable
- Defined in:
- lib/hipbot/adapters/xmpp.rb,
lib/hipbot/adapters/xmpp/client.rb
Defined Under Namespace
Classes: Client
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #invite_to_room(room, users) ⇒ Object
- #join_room(room) ⇒ Object
- #kick_from_room(room, users) ⇒ Object
- #leave_room(room, reason = '') ⇒ Object
- #restart! ⇒ Object
- #send_to_room(room, message) ⇒ Object
- #send_to_user(user, message) ⇒ Object
- #set_presence(status, type) ⇒ Object
- #set_topic(room, topic) ⇒ Object
- #start! ⇒ Object
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
10 11 12 |
# File 'lib/hipbot/adapters/xmpp.rb', line 10 def client @client end |
Instance Method Details
#invite_to_room(room, users) ⇒ Object
20 21 22 |
# File 'lib/hipbot/adapters/xmpp.rb', line 20 def invite_to_room(room, users) client.invite(user_ids(users), room.id) end |
#join_room(room) ⇒ Object
44 45 46 |
# File 'lib/hipbot/adapters/xmpp.rb', line 44 def join_room(room) client.join(room.id) end |
#kick_from_room(room, users) ⇒ Object
24 25 26 |
# File 'lib/hipbot/adapters/xmpp.rb', line 24 def kick_from_room(room, users) client.kick(user_ids(users), room.id) end |
#leave_room(room, reason = '') ⇒ Object
48 49 50 |
# File 'lib/hipbot/adapters/xmpp.rb', line 48 def leave_room(room, reason = '') client.exit(room.id, reason) end |
#restart! ⇒ Object
16 17 18 |
# File 'lib/hipbot/adapters/xmpp.rb', line 16 def restart! start! end |
#send_to_room(room, message) ⇒ Object
28 29 30 |
# File 'lib/hipbot/adapters/xmpp.rb', line 28 def send_to_room(room, ) client.(:groupchat, room.id, ) end |
#send_to_user(user, message) ⇒ Object
32 33 34 |
# File 'lib/hipbot/adapters/xmpp.rb', line 32 def send_to_user(user, ) client.(:chat, user.id, ) end |
#set_presence(status, type) ⇒ Object
40 41 42 |
# File 'lib/hipbot/adapters/xmpp.rb', line 40 def set_presence(status, type) client.set_presence(status, type) end |
#set_topic(room, topic) ⇒ Object
36 37 38 |
# File 'lib/hipbot/adapters/xmpp.rb', line 36 def set_topic(room, topic) client.(:groupchat, room.id, nil, topic) end |
#start! ⇒ Object
12 13 14 |
# File 'lib/hipbot/adapters/xmpp.rb', line 12 def start! self.client = self.class::Client.new.client end |