public static void InviteToDialog(string login, string nameDialog) { try { Content content = new Content("Invite", "*", login, "*", nameDialog, "*"); string sms = content.GetContent(content); ListOfDialogs.GetListDialogs().First(d => d.NameDialog == nameDialog).dialog.Add(OnlineUsers.onlineUsers.First(c => c.name == login)); SendMessage(sms, OnlineUsers.onlineUsers.First(c => c.name == login)); } catch (Exception e) { CrashReports.Add(e.Message, "ClientComands - InviteToDialog"); } Log.Add(login, "InviteToDialog", "ClientComands - InviteToDialog "); }
public static void ShowAllDialogs(Client client) { try { Content content = new Content("ShowAllDialogs", "*", "*", "", "*", ""); foreach (Dialog dialog in ListOfDialogs.GetListDialogs()) { if (dialog.PrivatDialog == false) { content.Message += dialog.NameDialog + ";"; } } string sms = content.GetContent(content); SendMessage(sms, client); } catch (Exception e) { CrashReports.Add(e.Message, "ClientComands - ShowAllDialogs"); } Log.Add(client.login, "ShowAllDialogs", "ClientComands - ShowAllDialogs "); }
public static void NewMessage(string nameDialog, string message, string login) { try { Content content = new Content("SendMessage", "*", login, "*", nameDialog, message); string sms = content.GetContent(content); ListOfDialogs.GetListDialogs().First(d => d.NameDialog == nameDialog).messages.Add(message); foreach (Client client in ListOfDialogs.GetListDialogs().First(d => d.NameDialog == nameDialog).dialog) { if (client != null && client.name != login) { SendMessage(sms, client); } } } catch (Exception e) { CrashReports.Add(e.Message, "ClientComands - NewMessage"); } Log.Add(login, "NewMessage", "ClientComands - NewMessage "); }
public static void LogOut(string login) { try { OnlineUsers.onlineUsers.Remove(OnlineUsers.onlineUsers.First(c => c.name == login)); foreach (Dialog dialog in ListOfDialogs.GetListDialogs()) { foreach (Client client in dialog.dialog) { if (client.name == login) { dialog.dialog.Remove(client); return; } } } } catch (Exception e) { CrashReports.Add(e.Message, "ClientComands - LogOut"); } Log.Add(login, "LogOut", "ClientComands - LogOut "); }