Class: Safubot::XMPP::Message
- Inherits:
-
Object
- Object
- Safubot::XMPP::Message
- Includes:
- MongoMapper::Document
- Defined in:
- lib/safubot/xmpp.rb
Overview
A Message is a Request source representing a single XMPP chat stanza.
Class Method Summary collapse
-
.from(raw) ⇒ Object
Creates a new Message.
Instance Method Summary collapse
-
#make_request ⇒ Object
Retrieves or creates an associated Request.
-
#user ⇒ Object
Retrieves the KnownUser associated with this Message.
-
#username ⇒ Object
Retrieves the sender’s username from the JID.
Class Method Details
Instance Method Details
#make_request ⇒ Object
Retrieves or creates an associated Request.
67 68 69 |
# File 'lib/safubot/xmpp.rb', line 67 def make_request self.request || self.request = Request.create(:user => user, :source => self, :text => self.text) end |
#user ⇒ Object
Retrieves the KnownUser associated with this Message.
62 63 64 |
# File 'lib/safubot/xmpp.rb', line 62 def user KnownUser.by_xmpp(self.from) end |
#username ⇒ Object
Retrieves the sender’s username from the JID.
57 58 59 |
# File 'lib/safubot/xmpp.rb', line 57 def username self.from.split('@')[0] end |