private void Instance_PresenceChanged(object sender, UserPresenceEventArgs e) { if (e.IsPresent) { StartCoroutine(DelayAudioStart(e.IsPresent)); } else { SetBackgroundPlaying(e.IsPresent); } }
private void Update() { bool isMounted = IsMounted; if (_WasMounted != isMounted) { _WasMounted = isMounted; var ev = PresenceChanged; if (ev != null) { var args = new UserPresenceEventArgs(isMounted); ev(this, args); } } }
internal async Task MucClient_OccupantPresence(object Sender, UserPresenceEventArgs e) { RoomNode RoomNode = await this.GetRoomNode(e.RoomId, e.Domain); OccupantNode OccupantNode = RoomNode.GetOccupantNode(e.NickName, e.Affiliation, e.Role, e.FullJid); ChatView View = null; if (!OccupantNode.Availability.HasValue || e.Availability != OccupantNode.Availability.Value) { OccupantNode.Availability = e.Availability; OccupantNode.OnUpdated(); View = MainWindow.currentInstance.FindRoomView(e.From, XmppClient.GetBareJID(e.To)); if (!(View is null)) { switch (OccupantNode.Availability) { case Availability.Online: View.Event("Online.", e.NickName, string.Empty); break; case Availability.Offline: View.Event("Offline.", e.NickName, string.Empty); break; case Availability.Away: View.Event("Away.", e.NickName, string.Empty); break; case Availability.Chat: View.Event("Ready to chat.", e.NickName, string.Empty); break; case Availability.DoNotDisturb: View.Event("Busy.", e.NickName, string.Empty); break; case Availability.ExtendedAway: View.Event("Away (extended).", e.NickName, string.Empty); break; } } } await this.MucClient_RoomPresence(Sender, e, View); }
private async Task MucClient_RoomDestroyed(object Sender, UserPresenceEventArgs e) { await this.MucClient_RoomPresence(Sender, e); }
private async Task MucClient_RoomPresence(object _, UserPresenceEventArgs e, ChatView View) { if ((e.MucStatus?.Length ?? 0) > 0 || e.RoomDestroyed) { RoomNode RoomNode = await this.GetRoomNode(e.RoomId, e.Domain); if (View is null) { View = MainWindow.currentInstance.FindRoomView(e.From, XmppClient.GetBareJID(e.To)); } if (!(View is null)) { foreach (MucStatus Status in e.MucStatus ?? new MucStatus[0]) { switch (Status) { case MucStatus.AffiliationChanged: if (e.Affiliation.HasValue) { View.Event("New affiliation: " + e.Affiliation.ToString(), e.NickName, string.Empty); } break; case MucStatus.LoggingEnabled: View.Event("This room logs messages.", e.NickName, string.Empty); break; case MucStatus.LoggingDisabled: View.Event("This room does not log messages.", e.NickName, string.Empty); break; case MucStatus.NickModified: View.Event("Nick-name changed.", e.NickName, string.Empty); break; case MucStatus.RoomNonAnonymous: View.Event("This room does not anonymous.", e.NickName, string.Empty); break; case MucStatus.RoomSemiAnonymous: View.Event("This room is semi-anonymous.", e.NickName, string.Empty); break; case MucStatus.RoomAnonymous: View.Event("This room does anonymous.", e.NickName, string.Empty); break; case MucStatus.FullJidVisisble: View.Event("All participants in this room have access to the full JID of each other.", e.NickName, string.Empty); break; case MucStatus.ShowsUnavailableMembers: View.Event("This room displays unavailable members.", e.NickName, string.Empty); break; case MucStatus.DoesNotShowUnavailableMembers: View.Event("This room hieds unavailable members.", e.NickName, string.Empty); break; case MucStatus.NonPrivacyRelatedConfigurationChange: View.Event("A configuration that does not affect privacy changed.", e.NickName, string.Empty); break; case MucStatus.OwnPresence: break; case MucStatus.Created: View.Event("Room created.", e.NickName, string.Empty); break; case MucStatus.Banned: View.Event("Banned from the room.", e.NickName, string.Empty); break; case MucStatus.NewRoomNickName: View.Event("New room nick-name.", e.NickName, string.Empty); break; case MucStatus.Kicked: View.Event("Temporarily kicked from the room.", e.NickName, string.Empty); break; case MucStatus.RemovedDueToAffiliationChange: View.Event("Removed from the room due to an affiliation change.", e.NickName, string.Empty); break; case MucStatus.RemovedDueToNonMembership: View.Event("Removed from the room, since no longer member.", e.NickName, string.Empty); break; case MucStatus.RemovedDueToSystemShutdown: View.Event("Removed from the room due to system shutdown.", e.NickName, string.Empty); break; case MucStatus.RemovedDueToFailure: View.Event("Removed from the room due to technical problems.", e.NickName, string.Empty); break; } } } if (e.RoomDestroyed) { View?.Event("Room has been destroyed on the host.", e.NickName, string.Empty); RoomNode.Parent.RemoveChild(RoomNode); RoomNode.Parent.OnUpdated(); } } }
private Task MucClient_RoomPresence(object Sender, UserPresenceEventArgs e) { return(this.MucClient_RoomPresence(Sender, e, null)); }