Class: Pipio::Event
- Inherits:
-
XMLMessage
- Object
- Message
- XMLMessage
- Pipio::Event
- Defined in:
- lib/pipio/messages/event.rb
Overview
Pidgin does not have Events, but Adium does. Pidgin mostly uses system messages to display what Adium calls events. These include sending a file, starting a Direct IM connection, or an error in chat.
Constant Summary collapse
- LIB_PURPLE =
All of event_type libPurple.
[ # file transfer /Starting transfer of .+ from (.+)/, /^Offering to send .+ to (.+)$/, /(.+) is offering to send file/, /^Transfer of file .+ complete$/, /Error reading|writing|accessing .+: .+/, /You cancell?ed the transfer of/, /File transfer cancelled/, /(.+?) cancell?ed the transfer of/, /(.+?) cancelled the file transfer/, # Direct IM - actual (dis)connect events are their own types /^Attempting to connect to (.+) at .+ for Direct IM\./, /^Asking (.+) to connect to us at .+ for Direct IM\./, /^Attempting to connect via proxy server\.$/, /^Direct IM with (.+) failed/, # encryption /Received message encrypted with wrong key/, /^Requesting key\.\.\.$/, /^Outgoing message lost\.$/, /^Conflicting Key Received!$/, /^Error in decryption- asking for resend\.\.\.$/, /^Making new key pair\.\.\.$/, # sending errors /^Last outgoing message not received properly- resetting$/, /Resending\.\.\./, # connection errors /Lost connection with the remote user:.+/, # chats /^.+ entered the room\.$/, /^.+ left the room\.$/ ]
- IGNORE =
Adium ignores SN/alias changes.
[/^.+? is now known as .+?\.<br\/?>$/]
- MAP =
Each key maps to an event_type string. The keys will be matched against a line of chat and the partner’s alias will be in regex group 1, IF the alias is matched.
{ # .+ is not an alias, it's a proxy server so no grouping /^Attempting to connect to .+\.$/ => 'direct-im-connect', # NB: pidgin doesn't track when Direct IM is disconnected, AFAIK /^Direct IM established$/ => 'directIMConnected', /Unable to send message/ => 'chat-error', /You missed .+ messages from (.+) because they were too large/ => 'chat-error', /User information not available/ => 'chat-error' }
Instance Attribute Summary collapse
-
#event_type ⇒ Object
readonly
Returns the value of attribute event_type.
Attributes inherited from XMLMessage
Attributes inherited from Message
#sender_alias, #sender_screen_name, #time
Instance Method Summary collapse
-
#initialize(sender_screen_name, time, sender_alias, body, event_type) ⇒ Event
constructor
A new instance of Event.
- #to_s ⇒ Object
Constructor Details
#initialize(sender_screen_name, time, sender_alias, body, event_type) ⇒ Event
Returns a new instance of Event.
56 57 58 59 |
# File 'lib/pipio/messages/event.rb', line 56 def initialize(sender_screen_name, time, sender_alias, body, event_type) super(sender_screen_name, time, sender_alias, body) @event_type = event_type end |
Instance Attribute Details
#event_type ⇒ Object (readonly)
Returns the value of attribute event_type.
61 62 63 |
# File 'lib/pipio/messages/event.rb', line 61 def event_type @event_type end |
Instance Method Details
#to_s ⇒ Object
63 64 65 |
# File 'lib/pipio/messages/event.rb', line 63 def to_s %(<event type="#{@event_type}" sender="#{@sender_screen_name}" time="#{adium_formatted_time}" alias="#{@sender_alias}">#{@styled_body}</event>) end |