Class: BitlbeeConfig::Accounts::Facebook
- Inherits:
-
Jabber
- Object
- BitlbeeConfig::Account
- Jabber
- BitlbeeConfig::Accounts::Facebook
- Defined in:
- lib/bitlbee_config/accounts/facebook.rb
Constant Summary collapse
- USERNAME_SUFFIX =
"@chat.facebook.com"
Instance Attribute Summary collapse
-
#auth_strategy ⇒ Object
Returns the value of attribute auth_strategy.
Attributes inherited from BitlbeeConfig::Account
#autoconnect, #cleartext_password, #handle, #password, #protocol, #server, #settings, #tag, #user
Instance Method Summary collapse
-
#add_auth_strategy_options(init_options) ⇒ Hash
Depending on the authentication strategy, we set a few things.
-
#ensure_handle_is_suffixed ⇒ Object
We don’t want the user to have to enter “@chat.facebook.com” with their handle, so we do it for them.
-
#initialize(options = {}) ⇒ Facebook
constructor
A new instance of Facebook.
Methods inherited from BitlbeeConfig::Account
#build_xml, create_new_account, from_xml, #id, #regenerate_password_if_needed
Methods included from XmlBuildable
Constructor Details
#initialize(options = {}) ⇒ Facebook
Returns a new instance of Facebook.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/bitlbee_config/accounts/facebook.rb', line 8 def initialize( = {}) # username needs to be downcased when not using OAuth. Just always downcase it, always works [:handle] &&= [:handle].downcase # unless otherwise specified, use oauth authentication @auth_strategy = .delete(:auth_strategy) || :oauth = () super({ tag: "fb", nick_format: "%full_name" }.merge()) ensure_handle_is_suffixed if @handle end |
Instance Attribute Details
#auth_strategy ⇒ Object
Returns the value of attribute auth_strategy.
4 5 6 |
# File 'lib/bitlbee_config/accounts/facebook.rb', line 4 def auth_strategy @auth_strategy end |
Instance Method Details
#add_auth_strategy_options(init_options) ⇒ Hash
Depending on the authentication strategy, we set a few things
33 34 35 36 37 38 39 40 41 |
# File 'lib/bitlbee_config/accounts/facebook.rb', line 33 def () case @auth_strategy when :oauth [:oauth] = "on" [:cleartext_password] ||= "" end end |
#ensure_handle_is_suffixed ⇒ Object
We don’t want the user to have to enter “@chat.facebook.com” with their handle, so we do it for them
25 26 27 |
# File 'lib/bitlbee_config/accounts/facebook.rb', line 25 def ensure_handle_is_suffixed @handle += USERNAME_SUFFIX unless @handle =~ /#{ USERNAME_SUFFIX }$/ end |