public void Xmpp_OnListGroup(object sender, string[] rooms) { if (rooms.Length == 0) { return; } List <AppCore.User> groups = new List <AppCore.User>(); foreach (string room in rooms) { AppCore.User gUser = userService.turnGroupToUserToList(room, room); groups.Add(gUser); //if (room.Equals(rooms[rooms.Length - 1])) //{ if (context != null) { BaseAppCompatActivity o = (BaseAppCompatActivity)context; o.saveSeachGroups(groups); this.App.Xmpp.JoinGroup(room); } //} } }
public void Xmpp_OnMessage(object sender, MessageEventArgs e) { if (appPreferences.isFisrtAcess(AppPreferences.FIRST_ACCESS) == true) { return; } if (context.GetType() == typeof(SessionActivity)) { SessionActivity session = (SessionActivity)context; session.Xmpp_OnMessage(session, e); } else if (context.GetType() == typeof(ChatActivity)) { ChatActivity chat = (ChatActivity)context; chat.Xmpp_OnMessage(sender, e); } else if (context.GetType() == typeof(ContacPhoneActivity)) { ContacPhoneActivity cp = (ContacPhoneActivity)context; cp.Xmpp_OnMessage(sender, e); } if (context.GetType() != typeof(ChatActivity)) { BaseAppCompatActivity o = (BaseAppCompatActivity)context; o.CountMessage(sender, e); } }
public void Xmpp_OnInvit(object sender, MessageEventArgs e) { if (context.GetType() == typeof(SessionActivity)) { SessionActivity o = (SessionActivity)context; o.OnInvit(sender, e); } else { BaseAppCompatActivity o = (BaseAppCompatActivity)context; o.OnInvit(sender, e); } }
public void StartSignalling() { if (this.App.Xmpp == null) { return; } SignallingStarted = true; App.StartSignalling((error) => { if (error != null) { BaseAppCompatActivity o = (BaseAppCompatActivity)context; o.Alert(error); } }); }
public void init(Context context) { App = App.Instance; this.context = context; connectivityManager = (ConnectivityManager) context.GetSystemService(Context.ConnectivityService); if (appPreferences == null) { appPreferences = new AppPreferences(Application.Context); } if (userService == null) { userService = new UserService(appPreferences); } userRecentsAndGroups = LegionUtils.getGroupsTempToList(AppPreferences.GROUPS_TEMP, appPreferences); if (Username != null && Password != null) { if (IsOnline()) { if (IS_TRY_CONNECT) { if (App.Xmpp != null) { App.Xmpp.Connect(); } else { loadXmppConnect(); } } else { loadXmppConnect(); } } else { BaseAppCompatActivity o = (BaseAppCompatActivity)context; o.Alert("You are Offline!"); } } StartSignalling(); }
public void Xmpp_OnJoinGroup(object sender, string roomJid) { Messaging.Log.Info("joined a room " + roomJid); if (roomJid != null) { List <AppCore.User> userGroups = LegionUtils.getGroupsTempToList(AppPreferences.GROUPS_TEMP, appPreferences); AppCore.User group = new AppCore.User(); group.Jid = roomJid + "@" + AppCore.Utils._MUS_SERVER; group.isGroup = true; if (userGroups.Any(x => x.Jid != (group.Jid))) { userGroups.Add(group); if (context != null) { BaseAppCompatActivity o = (BaseAppCompatActivity)context; o.saveSeachGroups(userGroups); } } } }
/// <summary> /// Handle incoming call /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void Xmpp_OnReceiveSessionInitiate(object sender, Messaging.Jingle.JingleSdpEventArgs e) { foreach (string jidWithHash in LIST_USERS_ONLINE) { if (jidWithHash.Contains(e.From)) { e.From = jidWithHash; } } this.App.Jid = e.From; this.App.Sdp = e.Sdp; var sdp = SDPMessage.Parse(e.Sdp); /* * foreach (var md in sdp.MediaDescriptions) * { * if (md.Media.MediaType == SDPMediaType.Video) * { * foreach (var ma in md.MediaAttributes) * { * * if (ma is SDPReceiveOnlyAttribute) * { * Log.Info("ma is SDPReceiveOnlyAttribute "); * } * if (ma is SDPInactiveAttribute) * { * Log.Info("ma is SDPInactiveAttribute"); * } * if (ma is SDPSendOnlyAttribute) * { * Log.Info("ma is SDPSendOnlyAttribute"); * } * if (ma is SDPSendReceiveAttribute) * { * Log.Info("ma is SDPSendReceiveAttribute"); * } * * //if (ma is SDPReceiveOnlyAttribute || ma is SDPInactiveAttribute) * //{ * * // Signalling.IS_CALL_VIDEO = false; * // // Remote participant is NOT sending video. * // // ReceiveOnly: not sending video, but willing to receive video * // // Inactive: not sending video, and doesn't want to receive video either * //} * //else if (ma is SDPSendOnlyAttribute || ma is SDPSendReceiveAttribute) * //{ * // //is call audio * // Signalling.IS_CALL_VIDEO = true; * // // Remote participant IS sending video. * // // SendOnly: sending video, but doesn't want to receive video * // // SendReceive: sending video, and willing to receive video * //} * } * } * } */ if (context != null) { BaseAppCompatActivity o = (BaseAppCompatActivity)context; o.Xmpp_OnReceiveSessionInitiate(sender, e); } }