public FrmGroupChat(XmppClient xmppClient, Jid roomJid, string nickname, ListView listContract) { InitializeComponent(); local_history = new HistoryTransactionTableAdapter(); connection = new SqlCeConnection(local_history.Connection.ConnectionString); _roomJid = roomJid; _xmppClient = xmppClient; _nickname = nickname; _listContract = listContract; fm.XmppClient = FrmLogin.Instance.xmppClient; fm.OnFile += fm_OnFile; Text = roomJid.User + " Group"; ; mm = new MucManager(xmppClient); // Setup new Message Callback using the MessageFilter _xmppClient.MessageFilter.Add(roomJid, new BareJidComparer(), MessageCallback); // Setup new Presence Callback using the PresenceFilter _xmppClient.PresenceFilter.Add(roomJid, new BareJidComparer(), PresenceCallback); GetLastRow(_xmppClient.Username, _xmppClient.XmppDomain, _roomJid.Bare, out LastDtDB); btnHistory.Enabled = false; Form.CheckForIllegalCrossThreadCalls = false; Instance = this; }
//static void xmpp_OnReadXml(object sender, string xml) //{ // Console.Write("--------xml--------"); // Console.Write(xml); // Console.Write(sender); // Console.Write("--------xml--------"); // // throw new NotImplementedException(); //} /* * * Create room * */ private static void CreateRoom() { MucManager muc = new MucManager(xmpp); Jid RoomJid = new Jid("[email protected]"); muc.CreateReservedRoom(RoomJid, new IqCB(OnCreateRoom)); muc.JoinRoom(RoomJid, "[email protected]"); muc.JoinRoom(RoomJid, "[email protected]"); muc.JoinRoom(RoomJid, "[email protected]"); muc.JoinRoom(RoomJid, "[email protected]"); }
/// <summary> /// Joins the specified room. /// </summary> /// <param name="room">The room.</param> /// <returns></returns> public bool Join(Room room) { var manager = new MucManager(connection); var jid = new Jid(room.JabberId, "conf.hipchat.com", string.Empty); manager.JoinRoom(jid, current.Name); Out.WriteLine("{1:HH:mm:ss} Joined room: {0}.", room.Name, DateTime.Now); return(true); }
public FormConferention(string _roomJid) { InitializeComponent(); roomJid = new Jid(_roomJid); xmpp = Settings.xmpp; mainJid = Settings.jid; nickname = Settings.nickname; muc = new MucManager(xmpp); muc.JoinRoom(roomJid, nickname); xmpp.MesagageGrabber.Add(roomJid, new BareJidComparer(), new MessageCB(MessageCallback), null); xmpp.PresenceGrabber.Add(roomJid, new BareJidComparer(), new PresenceCB(PresenceCallback), null); }
/// <summary> /// Leaves the specified room. /// </summary> /// <param name="room">The room.</param> public bool Leave(Room room) { var manager = new MucManager(connection); var jid = new Jid(room.JabberId, "conf.hipchat.com", string.Empty); manager.LeaveRoom(jid, current.Name); Out.WriteLine("Left room: {0}.", room.Name); return(true); }
void xmpp_OnLogin(object sender) { MucManager mucManager = new MucManager(_client); string[] rooms = _config.Rooms.Split(','); foreach (string room in rooms) { Jid jid = new Jid(room + "@" + _config.ConferenceServer); mucManager.JoinRoom(jid, _config.RoomNick); } }
/// <summary> /// Fires when the XMPP Client receives a message. /// </summary> /// <param name="sender"> /// The Sender /// </param> /// <param name="msg"> /// The Message /// </param> private void XmppOnMessage(object sender, Message msg) { switch (msg.Type) { case MessageType.normal: if (msg.From.Server == "conference." + this.client.Config.ChatHost) { string rname = msg.From.User; var m = new MucManager(this.xmpp); m.JoinRoom(msg.From, msg.From.User); ChatRoom theRoom = this.GetRoom(new User(msg.From), true); this.xmpp.RosterManager.AddRosterItem(msg.From, msg.From.User); } break; case MessageType.error: { if (msg.From.User.ToLowerInvariant().Contains("gameserv")) { return; } ChatRoom nc = this.GetRoom(new User(msg.From.Bare), true); nc.OnMessage(this, msg); break; } case MessageType.chat: { switch (msg.Chatstate) { case Chatstate.None: // TODO Group chat whispers in the form of {roomname}@conference.server.octgn.info/{username} need to be handled here. ChatRoom nc = this.GetRoom(new User(msg.From.Bare)); nc.OnMessage(sender, msg); break; } break; } case MessageType.groupchat: { ChatRoom nc = this.GetRoom(new User(msg.From.Bare), true); nc.OnMessage(this, msg); break; } case MessageType.headline: break; } }
private void OnLogin(object sender) { var mucManager = new MucManager(_client); var rooms = Robot.Settings.Get("HipChatRooms").Split(','); var roomJids = rooms.Select(room => new Jid(room + "@" + _conferenceServer)); foreach (var jid in roomJids) { mucManager.JoinRoom(jid, Robot.Settings.Get("HipChatRoomNick")); JoinedRoomJids.Add(jid); } }
public override bool OnLoad(Gui.MainWindow window) { Config = Configuration.Load(); Window = window; var loginWindow = new LoginWindow { txtUsername = { Text = Config.Email } }; if (!loginWindow.ShowDialog().HasValue || LoginData == null) { return(false); } Config.Email = loginWindow.Username; if (loginWindow.chkRemember.IsChecked != null && loginWindow.chkRemember.IsChecked.Value) { Config.Save(); } SelfJid = new Jid(Nickname + "@chat.hipchat.com"); window.Title = "Chatterbox - " + GroupName; HipchatClient = new XmppClientConnection("chat.hipchat.com"); HipchatClient.Open(Nickname, loginWindow.Password); HipchatClient.Status = "Chatterbox"; HipchatClient.Show = ShowType.chat; HipchatClient.AutoResolveConnectServer = false; HipchatClient.OnLogin += HipchatClient_OnLogin; MucManager = new MucManager(HipchatClient); HipchatClient.OnRosterStart += sender => Users.Clear(); HipchatClient.OnRosterItem += HipchatClient_OnRosterItem; HipchatClient.OnMessage += HipchatClient_OnMessage; HipchatClient.OnPresence += HipchatClient_OnPresence; Lobby = new LobbyControl(); Lobby.OnRoomJoin += Lobby_OnRoomJoin; Window.SetLobbyRoom(Lobby); return(true); }
public EndOfGamePage(EndOfGameStats statistics) { InitializeComponent(); RenderStats(statistics); Client.SwitchPage(Client.MainPage); Client.runonce = false; Client.ChampId = -1; RoomJid = Client.GetChatroomJid(statistics.RoomName, statistics.RoomPassword, false); newRoom = new MucManager(Client.XmppConnection); Client.XmppConnection.OnMessage += XmppConnection_OnMessage; Client.XmppConnection.OnPresence += XmppConnection_OnPresence; Client.RiotConnection.MessageReceived += RiotConnection_MessageReceived; newRoom.AcceptDefaultConfiguration(new Jid(RoomJid)); newRoom.JoinRoom(new Jid(RoomJid), Client.LoginPacket.AllSummonerData.Summoner.Name); }
private void OnClientLogin(object sender) { var mucManager = new MucManager(_client); foreach (string room in _rooms.Union(_logRooms).Distinct()) { var jid = new Jid(room + "@" + _confhost); mucManager.JoinRoom(jid, _roomNick); Rooms.Add(room); Logger.Info(string.Format("Joined Room '{0}'", room)); } foreach (string logRoom in _logRooms) { LogRooms.Add(logRoom); } }
public FrmGroupChat(XmppClient xmppClient, Jid roomJid, string nickname) { InitializeComponent(); _roomJid = roomJid; _xmppClient = xmppClient; _nickname = nickname; mm = new MucManager(xmppClient); // Setup new Message Callback using the MessageFilter _xmppClient.MessageFilter.Add(roomJid, new BareJidComparer(), MessageCallback); // Setup new Presence Callback using the PresenceFilter _xmppClient.PresenceFilter.Add(roomJid, new BareJidComparer(), PresenceCallback); }
private void OnClientLogin(object sender) { var mucManager = new MucManager(_client); var rooms = _api.GetAllRooms(); foreach (var room in rooms.Items) { var roomInfo = _api.GetRoom(room.Id); var jid = new Jid(roomInfo.XmppJid); mucManager.JoinRoom(jid, _botUser.Name); Rooms.Add(room.Name); LogRooms.Add(room.Name); Logger.Info(string.Format("Joined Room '{0}'", room.Name)); } }
private void XmppOnOnLogin(object sender) { myPresence.Type = PresenceType.available; myPresence.Show = ShowType.chat; MucManager = new MucManager(Xmpp); Jid room = new Jid("lobby@conference." + Host); MucManager.AcceptDefaultConfiguration(room); //MucManager.JoinRoom(room,Username,Password,false); Me = new NewUser(Xmpp.MyJID); Me.SetStatus(UserStatus.Online); Xmpp.PresenceManager.Subscribe(Xmpp.MyJID); if (OnLoginComplete != null) { OnLoginComplete.Invoke(this, LoginResults.Success); } }
public static XmppClient InitXmppClient(string userName, string passWord, string domain, string server) { StaticClass2.xmppClient = new XmppClient(userName, domain, passWord); StaticClass2.xmppClient.Hostname = server; //StaticClass.xmppClient.Open(); StaticClass2.pm = new PresenceManager(xmppClient); StaticClass2.rm = new RosterManager(xmppClient); StaticClass2.muc = new MucManager(xmppClient); StaticClass2.fm = new FileTransferManager(); //StaticClass.fm.OnProgress += Fm_OnProgress; //StaticClass.fm.OnEnd += Fm_OnEnd; return(StaticClass2.xmppClient); }
public void GroupChat()//Jid roomJid, string nickname) { XmppClient xmppClient = XmppClients[Context.ConnectionId]; mm = new MucManager(xmppClient); // mm.EnterRoom("ALLURE786", "*****@*****.**"); // mm = new MucManager(xmppClient); mm.EnterRoom("ALLURE786", "*****@*****.**", true); mm.Invite("*****@*****.**", "ALLURE786", "Please join"); // mm.Invite("*****@*****.**", "ALLURE786", "Please join"); // Setup new Message Callback using the MessageFilter // xmppClient.MessageFilter.Add(roomJid, new BareJidComparer(), MessageCallback); // Setup new Presence Callback using the PresenceFilter // xmppClient.PresenceFilter.Add(roomJid, new BareJidComparer(), PresenceCallback); }
private void OnClientLogin(object sender) { var mucManager = new MucManager(_client); var rooms = _api.GetAllRooms(); foreach (var room in rooms.Items.Where(r => _roomList.Count == 0 || r.Name != null && _roomList.Contains(r.Name.ToUpper()))) { var roomInfo = _api.GetRoom(room.Id); _roomMap.Add(roomInfo.XmppJid, room.Id); var jid = new Jid(roomInfo.XmppJid); mucManager.JoinRoom(jid, _botUser.Name); Rooms.Add(room.Name); LogRooms.Add(room.Name); Logger.Info(string.Format("Joined Room '{0}'", room.Name)); } }
public override void Configure() { base.Configure(); _client = new XmppClientConnection(Server); _client.OnXmppConnectionStateChanged += this.XmppOnXmppConnectionStateChanged; _client.OnLogin += this.XmppOnLogin; _client.OnRosterItem += this.XmppOnRosterItem; _client.OnRosterEnd += this.XmppOnRosterEnd; _client.OnRosterStart += this.XmppOnRosterStart; _client.OnMessage += this.XmppOnMessage; _client.OnPresence += this.XmppOnPresence; _client.OnAgentItem += this.XmppOnAgentItem; _client.OnIq += this.XmppOnIq; _client.OnClose += this.XmppOnClose; _client.OnError += this.XmppOnError; _client.OnSocketError += this.XmppOnSocketError; _client.OnStreamError += this.XmppOnStreamError; _muc = new MucManager(_client); Outputs["XmppLobby"].OnMessage += XmppChatModule_OnMessage; }
public RiotChat() { xmpp = new XmppClientConnection { Server = "pvp.net", Port = 5223, ConnectServer = Session.Region.ChatServer, AutoResolveConnectServer = false, Resource = "xiff", UseSSL = true, KeepAliveInterval = 10, KeepAlive = true, UseCompression = true, AutoPresence = true, Status = new LeagueStatus(StatusMessage, Status).ToXML(), Show = ShowType.chat, Priority = 0 }; xmpp.OnMessage += Xmpp_OnMessage; xmpp.OnAuthError += (o, e) => Session.Log(e); xmpp.OnError += (o, e) => Session.Log(e); xmpp.OnLogin += o => Session.Log("Connected to chat server"); xmpp.Open(Session.Current.Account.LoginSession.AccountSummary.Username, "AIR_" + Session.Current.Account.LoginSession.Password); presence = new PresenceManager(xmpp); roster = new RosterManager(xmpp); lobby = new MucManager(xmpp); xmpp.OnRosterEnd += o => connected = true; xmpp.OnRosterItem += Xmpp_OnRosterItem; xmpp.OnPresence += Xmpp_OnPresence; timer = new Timer(1000) { AutoReset = true }; timer.Elapsed += UpdateProc; timer.Start(); }
public async void LoadStats() { i = 10; PingTimer = new Timer(1000); PingTimer.Elapsed += PingElapsed; PingTimer.Enabled = true; PingElapsed(1, null); InviteButton.IsEnabled = false; StartGameButton.IsEnabled = false; if (CurrentLobby == null) { CurrentLobby = await RiotCalls.AcceptInvite(Invite); } if (CurrentLobby.InvitationID != null) { string ObfuscatedName = Client.GetObfuscatedChatroomName(CurrentLobby.InvitationID.ToLower(), ChatPrefixes.Arranging_Game); string Jid = Client.GetChatroomJid(ObfuscatedName, CurrentLobby.ChatKey, false); newRoom = new MucManager(Client.XmppConnection); jid = new Jid(Jid); Client.XmppConnection.OnMessage += XmppConnection_OnMessage; Client.XmppConnection.OnPresence += XmppConnection_OnPresence; newRoom.AcceptDefaultConfiguration(jid); newRoom.JoinRoom(jid, Client.LoginPacket.AllSummonerData.Summoner.Name, CurrentLobby.ChatKey); RenderLobbyData(); } else { Client.GameStatus = "outOfGame"; Client.SetChatHover(); Client.SwitchPage(Client.MainPage); Client.ClearPage(typeof(TeamQueuePage)); Client.Log("Failed to join room."); } }
//Handles incoming messages static void MessageCallBack(object sender, agsXMPP.protocol.client.Message msg, object data) { if (msg.Body != null) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("{0}>> {1}", msg.From.User, msg.Body); Console.ForegroundColor = ConsoleColor.Green; } else { try { Console.WriteLine(msg.FirstChild.GetAttributeJid("jid")); MucManager _manager = new MucManager(xmpp); _manager.JoinRoom(msg.FirstChild.GetAttributeJid("jid"), "test"); } catch (Exception e) { Console.WriteLine(e); } } }
public GroupChatItem(string id, string title) { InitializeComponent(); ChatId = id; PlayerLabelName.Content = title; GroupTitle = title; if (ChatId == null) { return; } try { newRoom = new MucManager(Client.XmppConnection); } catch { return; } Client.XmppConnection.OnPresence += XmppConnection_OnPresence; Client.XmppConnection.OnMessage += XmppConnection_OnMessage; newRoom.AcceptDefaultConfiguration(new Jid(ChatId)); roomName = ChatId; newRoom.JoinRoom(new Jid(ChatId), Client.LoginPacket.AllSummonerData.Summoner.Name); }
public override Task Run() { _loginTcs = new TaskCompletionSource <bool>(); Task <bool> connect = _loginTcs.Task; if (_xmppConnection != null) { _xmppConnection.Close(); _xmppConnection = null; } _xmppConnection = new XmppClientConnection { Server = _host, ConnectServer = _connectHost, AutoResolveConnectServer = true, Username = _username, Password = _password }; if (_port > 0) { _xmppConnection.Port = _port; } _xmppConnection.KeepAlive = true; _xmppConnection.OnLogin += OnLogin; _xmppConnection.OnError += OnError; _xmppConnection.OnMessage += OnMessage; _xmppConnection.OnPresence += XmppConnectionOnOnPresence; _xmppConnection.OnRosterItem += OnClientRosterItem; _xmppConnection.OnXmppConnectionStateChanged += OnXmppConnectionStateChanged; Task.Factory.StartNew(() => { _xmppConnection.Open(); Thread.Sleep(CONNECT_TIMEOUT); _loginTcs.TrySetResult(false); }); if (!connect.Result) { throw new TimeoutException("XMPP adapter timed out while trying to login"); } else { MucManager muc = new MucManager(_xmppConnection); foreach (var room in _rooms) { try { muc.JoinRoom(string.Format("{0}@{1}", room, _confServer), _username, _password, true); Logger.Info(string.Format("Successfully joined room {0}", room)); Rooms.Add(string.Format("{0}@{1}", room, _confServer)); } catch (Exception ex) { Logger.Error("Failed to join room - " + ex.Message); } } foreach (var logroom in _logRooms) { try { muc.JoinRoom(string.Format("{0}@{1}", logroom, _confServer), _username, _password, true); Logger.Info(string.Format("Successfully joined room {0}", logroom)); LogRooms.Add(string.Format("{0}@{1}", logroom, _confServer)); } catch (Exception ex) { Logger.Error("Failed to join room - " + ex.Message); } } } return(_loginTcs.Task); }
private void Lobby_OnMessageReceived(object sender, object message) { if (message.GetType() != typeof(GameDTO)) { return; } var dto = message as GameDTO; Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() => { if (!HasConnectedToChat) { //Run once BaseMap map = BaseMap.GetMap(dto.MapId); MapLabel.Content = map.DisplayName; ModeLabel.Content = Client.TitleCaseString(dto.GameMode); GameTypeConfigDTO configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == dto.GameTypeConfigId); TypeLabel.Content = GetGameMode(configType.Id); SizeLabel.Content = dto.MaxNumPlayers / 2 + "v" + dto.MaxNumPlayers / 2; HasConnectedToChat = true; string obfuscatedName = Client.GetObfuscatedChatroomName(dto.Name.ToLower() + Convert.ToInt64(dto.Id), ChatPrefixes.Arranging_Practice); string Jid = Client.GetChatroomJid(obfuscatedName, dto.RoomPassword, false); newRoom = new MucManager(Client.XmppConnection); Client.XmppConnection.OnMessage += XmppConnection_OnMessage; Client.XmppConnection.OnPresence += XmppConnection_OnPresence; jid = new Jid(dto.RoomName); newRoom.AcceptDefaultConfiguration(jid); newRoom.JoinRoom(jid, Client.LoginPacket.AllSummonerData.Summoner.Name, dto.RoomPassword); } switch (dto.GameState) { case "TEAM_SELECT": { OptomisticLock = dto.OptimisticLock; LaunchedTeamSelect = false; BlueTeamListView.Items.Clear(); PurpleTeamListView.Items.Clear(); var allParticipants = new List <Participant>(dto.TeamOne.ToArray()); allParticipants.AddRange(dto.TeamTwo); int i = 0; bool purpleSide = false; foreach (Participant playerTeam in allParticipants) { i++; var lobbyPlayer = new CustomLobbyPlayer(); //var botPlayer = new BotControl(); if (playerTeam is PlayerParticipant) { var player = playerTeam as PlayerParticipant; lobbyPlayer = RenderPlayer(player, dto.OwnerSummary.SummonerId == player.SummonerId); ///BotParticipant botParticipant = playerTeam as BotParticipant; //botPlayer = RenderBot(botParticipant); IsOwner = dto.OwnerSummary.SummonerId == Client.LoginPacket.AllSummonerData.Summoner.SumId; StartGameButton.IsEnabled = IsOwner; if (Client.Whitelist.Count > 0) { if (!Client.Whitelist.Contains(player.SummonerName.ToLower())) { await RiotCalls.BanUserFromGame(Client.GameID, player.AccountId); } } } if (i > dto.TeamOne.Count) { i = 0; purpleSide = true; } if (!purpleSide) { BlueTeamListView.Items.Add(lobbyPlayer); } else { PurpleTeamListView.Items.Add(lobbyPlayer); } } } break; case "PRE_CHAMP_SELECT": case "CHAMP_SELECT": if (!LaunchedTeamSelect) { Client.ChampSelectDTO = dto; Client.LastPageContent = Client.Container.Content; Client.SwitchPage(new ChampSelectPage(dto.RoomName, dto.RoomPassword).Load(this)); LaunchedTeamSelect = true; } break; } })); }
private void Lobby_OnMessageReceived(object sender, object message) { if (message == null) { return; } if (message.GetType() != typeof(GameDTO)) { return; } var dto = message as GameDTO; Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() => { if (!HasConnectedToChat) { //Run once BaseMap map = BaseMap.GetMap(dto.MapId); MapLabel.Content = map.DisplayName; ModeLabel.Content = Client.TitleCaseString(dto.GameMode); GameTypeConfigDTO configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == dto.GameTypeConfigId); TypeLabel.Content = GetGameMode(configType.Id); SizeLabel.Content = dto.MaxNumPlayers / 2 + "v" + dto.MaxNumPlayers / 2; HasConnectedToChat = true; string obfuscatedName = Client.GetObfuscatedChatroomName(dto.Name.ToLower() + Convert.ToInt64(dto.Id), ChatPrefixes.Arranging_Practice); string Jid = Client.GetChatroomJid(obfuscatedName, dto.RoomPassword, false); newRoom = new MucManager(Client.XmppConnection); Client.XmppConnection.OnMessage += XmppConnection_OnMessage; Client.XmppConnection.OnPresence += XmppConnection_OnPresence; roomJid = new Jid(Jid); newRoom.AcceptDefaultConfiguration(roomJid); newRoom.JoinRoom(roomJid, Client.LoginPacket.AllSummonerData.Summoner.Name); } switch (dto.GameState) { case "TEAM_SELECT": { bool isSpectator = false; OptomisticLock = dto.OptimisticLock; LaunchedTeamSelect = false; BlueTeamListView.Items.Clear(); PurpleTeamListView.Items.Clear(); SpectatorListView.Items.Clear(); foreach (Participant playerTeam in dto.TeamOne) { if (playerTeam is PlayerParticipant) { var lobbyPlayer = new CustomLobbyPlayer(); var player = playerTeam as PlayerParticipant; lobbyPlayer = RenderPlayer(player, dto.OwnerSummary.SummonerId == player.SummonerId); Client.isOwnerOfGame = dto.OwnerSummary.SummonerId == Client.LoginPacket.AllSummonerData.Summoner.SumId; StartGameButton.IsEnabled = Client.isOwnerOfGame; AddBotBlueTeam.IsEnabled = Client.isOwnerOfGame; AddBotPurpleTeam.IsEnabled = Client.isOwnerOfGame; BlueTeamListView.Items.Add(lobbyPlayer); if (Client.Whitelist.Count <= 0) { continue; } if (!Client.Whitelist.Contains(player.SummonerName.ToLower())) { await RiotCalls.BanUserFromGame(Client.GameID, player.AccountId); } } else if (playerTeam is BotParticipant) { var botParticipant = playerTeam as BotParticipant; var botPlayer = new BotControl(); botPlayer = RenderBot(botParticipant); BlueTeamListView.Items.Add(botPlayer); } } foreach (Participant playerTeam in dto.TeamTwo) { if (playerTeam is PlayerParticipant) { var lobbyPlayer = new CustomLobbyPlayer(); var player = playerTeam as PlayerParticipant; lobbyPlayer = RenderPlayer(player, dto.OwnerSummary.SummonerId == player.SummonerId); Client.isOwnerOfGame = dto.OwnerSummary.SummonerId == Client.LoginPacket.AllSummonerData.Summoner.SumId; StartGameButton.IsEnabled = Client.isOwnerOfGame; AddBotBlueTeam.IsEnabled = Client.isOwnerOfGame; AddBotPurpleTeam.IsEnabled = Client.isOwnerOfGame; PurpleTeamListView.Items.Add(lobbyPlayer); if (Client.Whitelist.Count <= 0) { continue; } if (!Client.Whitelist.Contains(player.SummonerName.ToLower())) { await RiotCalls.BanUserFromGame(Client.GameID, player.AccountId); } } else if (playerTeam is BotParticipant) { var botParticipant = playerTeam as BotParticipant; var botPlayer = new BotControl(); botPlayer = RenderBot(botParticipant); PurpleTeamListView.Items.Add(botPlayer); } } foreach (GameObserver observer in dto.Observers) { if (observer.SummonerId == Client.LoginPacket.AllSummonerData.Summoner.SumId) { isSpectator = true; } var spectatorItem = new CustomLobbyObserver(); spectatorItem = RenderObserver(observer); SpectatorListView.Items.Add(spectatorItem); } if (isSpectator) { AddBotPurpleTeam.Visibility = Visibility.Hidden; AddBotBlueTeam.Visibility = Visibility.Hidden; JoinBlueTeamFromSpectator.Visibility = Visibility.Visible; JoinPurpleTeamFromSpectator.Visibility = Visibility.Visible; } else { AddBotPurpleTeam.Visibility = Visibility.Visible; AddBotBlueTeam.Visibility = Visibility.Visible; JoinBlueTeamFromSpectator.Visibility = Visibility.Hidden; JoinPurpleTeamFromSpectator.Visibility = Visibility.Hidden; } } break; case "PRE_CHAMP_SELECT": case "CHAMP_SELECT": if (!LaunchedTeamSelect) { Client.ChampSelectDTO = dto; Client.LastPageContent = Client.Container.Content; Client.SwitchPage(new ChampSelectPage(dto.RoomName, dto.RoomPassword).Load(this)); Client.GameStatus = "championSelect"; Client.SetChatHover(); LaunchedTeamSelect = true; } break; } })); }
private void _CreateChatRoom(XmppClient client, string chatRoomName, string roomNick) { _mucManager = new MucManager(client); _mucManager.EnterRoom(chatRoomName, roomNick); }
public void MucManager() { this.mucManager = new MucManager(xmppClient); }
public MucManager GetMucManager() { var muc = new MucManager(_xmppConnection); return(muc); }
public Muc(XmppClientConnection connection) { _connection = connection; _muc = new MucManager(connection); }
private void XmppOnOnMessage(object sender, Message msg) { switch (msg.Type) { case MessageType.normal: if (msg.From.Server == "conference." + Skylabs.Lobby.Client.Host) { var rname = msg.From.User; MucManager m = new MucManager(_xmpp); m.JoinRoom(msg.From, msg.From.User); var theRoom = GetRoom(new NewUser(msg.From), true); _xmpp.RosterManager.AddRosterItem(msg.From, msg.From.User); if (OnCreateRoom != null) { OnCreateRoom.Invoke(this, theRoom); } } break; case MessageType.error: { var nc = GetRoom(new NewUser(msg.From.Bare), true); nc.OnMessage(this, msg); break; } case MessageType.chat: { switch (msg.Chatstate) { case Chatstate.None: //TODO Group chat whispers in the form of {roomname}@conference.server.octgn.info/{username} need to be handled here. var nc = GetRoom(new NewUser(msg.From.Bare)); nc.OnMessage(sender, msg); break; case Chatstate.active: break; case Chatstate.inactive: break; case Chatstate.composing: break; case Chatstate.gone: break; case Chatstate.paused: break; default: throw new ArgumentOutOfRangeException(); } break; } case MessageType.groupchat: { var nc = GetRoom(new NewUser(msg.From.Bare), true); nc.OnMessage(this, msg); break; } case MessageType.headline: break; default: throw new ArgumentOutOfRangeException(); } }
public override async Task Topic(string roomName, params string[] messages) { var mucManager = new MucManager(_client); mucManager.ChangeSubject(new Jid(roomName), string.Join(" ", messages)); }