Browse code

Odosielanie informacie, ci je pouzivatel aplikacie pripojeny cez facebook

Cinan Rakosnik authored on 29/05/2013 at 15:54:24
Showing 3 changed files
... ...
@@ -87,6 +87,7 @@ this.App =
87 87
           name: response.vcard.name
88 88
           status: response.status
89 89
           avatar: response.vcard.avatar
90
+          isFB: response.is_facebook
90 91
         )
91 92
       )
92 93
 
... ...
@@ -146,16 +146,17 @@ class WsRosterController < WsController
146 146
     # Ziskaj informacie o mne (meno, stav, status...)
147 147
     def myself
148 148
         # TODO: v pripade viacerych uctov zjednotit meno a stav
149
-        vcard = {}
150
-        jid = presence = ''
151 149
 
152 150
         connection_store[:clients].each do |client|
153 151
             vcard = get_vcard_info(client)
154 152
             jid = client.jid.strip.to_s
155 153
             presence = uniform_presence(connection_store[:my_presences][client].show)
156
-        end
157 154
 
158
-        trigger_success jid: jid, vcard: vcard, status: presence
155
+            trigger_success jid: jid,
156
+                            vcard: vcard,
157
+                            status: presence,
158
+                            is_facebook: Signin.is_facebook(client.jid)
159
+        end
159 160
     end
160 161
 
161 162
     def me_update_status
... ...
@@ -21,6 +21,10 @@ module Signin
21 21
         @client.auth(pass)
22 22
     end
23 23
 
24
+    def self.is_facebook(client_jid)
25
+        client_jid.domain == 'chat.facebook.com'
26
+    end
27
+
24 28
     class LoginError < Exception
25 29
 
26 30
     end