Class: BitlbeeConfig::Accounts::Hipchat

Inherits:
Jabber show all
Defined in:
lib/bitlbee_config/accounts/hipchat.rb

Constant Summary collapse

USERNAME_SUFFIX =
"@chat.hipchat.com"

Instance Attribute Summary

Attributes inherited from BitlbeeConfig::Account

#autoconnect, #cleartext_password, #handle, #password, #protocol, #server, #settings, #tag, #user

Instance Method Summary collapse

Methods inherited from BitlbeeConfig::Account

#build_xml, create_new_account, from_xml, #id, #regenerate_password_if_needed

Methods included from XmlBuildable

#to_xml_with_options

Constructor Details

#initialize(options = {}) ⇒ Hipchat

Returns a new instance of Hipchat.



6
7
8
9
10
11
12
# File 'lib/bitlbee_config/accounts/hipchat.rb', line 6

def initialize(options = {})
  super({ tag: "hipchat",
          nick_format: "%full_name"
        }.merge(options))

  ensure_handle_is_suffixed if @handle
end

Instance Method Details

#ensure_handle_is_suffixedObject

We don’t want the user to have to enter “@chat.facebook.com” with their handle, so we do it for them



15
16
17
# File 'lib/bitlbee_config/accounts/hipchat.rb', line 15

def ensure_handle_is_suffixed
  @handle += USERNAME_SUFFIX unless @handle =~ /#{ USERNAME_SUFFIX }$/
end