private void OnPresence(FB_Presence presenceEvent)
 {
     foreach (var(fbUser, fbStatus) in presenceEvent.statuses)
     {
         var user = GetUser(fbUser);
         if (user == null)
         {
             continue;
         }
         user.IsActive   = fbStatus.active;
         user.LastActive = fbStatus.last_active.FromUnixEpoch();
     }
 }
Example #2
0
     public static IEnumerable <FB_Event> parse_events(Session session, string topic, JToken data)
     {
         // See Mqtt._configure_connect_options for information about these topics
         if (topic == "/t_ms")
         {
             if (data?.get("deltas") != null)
             {
                 foreach (var delta in data?.get("deltas"))
                 {
                     foreach (var ev in _parse_delta(session, delta))
                     {
                         yield return(ev);
                     }
                 }
             }
         }
         else if (topic == "/thread_typing")
         {
             yield return(FB_TypingStatus._from_thread_typing(session, data));
         }
         else if (topic == "/orca_typing_notifications")
         {
             yield return(FB_TypingStatus._from_orca(session, data));
         }
         else if (topic == "/legacy_web")
         {
             if (data.get("type")?.Value <string>() == "jewel_requests_add")
             {
                 yield return(FB_FriendRequest._parse(session, data));
             }
             else
             {
                 yield return new FB_UnknownEvent()
                        {
                            source = "/legacy_web", data = data
                        }
             };
         }
         else if (topic == "/orca_presence")
         {
             yield return(FB_Presence._parse(session, data));
         }
         else
         {
             yield return new FB_UnknownEvent()
                    {
                        source = topic, data = data
                    }
         };
     }
 }