public void RemoveUser(UserListEntry user) { if (_users.Contains(user)) { _users.Remove(user); } }
protected virtual void SendLst(NotificationConnection c, int trId, String name, IEnumerable <UserListEntry> userEnum, int serverSerial) { List <UserListEntry> list = userEnum as List <UserListEntry> ?? new List <UserListEntry>(userEnum); int cnt = list.Count; if (cnt == 0) { // if list is empty: // LST TrID LIST Ser# 0 0 Command response = new Command(Verb.Lst, trId, name, serverSerial.ToString(), "0", "0"); Server.Send(c, response); return; } for (int i = 0; i < cnt; i++) { UserListEntry entry = list[i]; // LST <trid> <listName> <serial> <itemIdx> <cntItems> <userHandle> <userCustomName> Command response = new Command(Verb.Lst, trId, name, serverSerial.ToString(), (i + 1).ToString(), cnt.ToString(), entry.User.UserHandle, entry.CustomName); Server.Send(c, response); } }
public void AddUser(UserListEntry user) { if (!_users.Contains(user)) { _users.Add(user); } }
public override void ASNotifyAddRL(NotificationConnection recipient, UserListEntry newRLEntry) { // ADD TrID LIST ser# UserHandle CustomUserName // as this is async, TrID == 0 String serial = recipient.User.Properties.Serial.ToStringInvariant(); String userHandle = newRLEntry.User.UserHandle; String customName = newRLEntry.CustomName; Command add = new Command(Verb.Add, 0, "RL", serial, userHandle, customName); Server.Send(recipient, add); }
public void AddUser() { UserListEntry entry = Instantiate(entryPrefab, transform).GetComponent <UserListEntry>(); entry.gameObject.SetActive(true); entry.Init("username" + entries.Count(e => e.username.Contains("username")), "Employee", "John Appleseed"); entries.Add(entry); using (SqliteCommand command = new SqliteCommand(Database.DB)) { command.CommandText = string.Format("INSERT INTO users (username) VALUES (\"{0}\")", entry.username); command.ExecuteNonQuery(); } }
public override void ASNotifyRng(UserListEntry caller, NotificationConnection recipient, SwitchboardInvitation invitation) { // <<< RNG <SessionID> <SwitchboardServerAddress> <SP> <AuthChallengeInfo> <CallingUserHandle> <CallingUserFriendlyName> invitation.Protocol = this.Name; // note this property's value is appropriate for the current protocol subclass SwitchboardSession session = invitation.Session; String sessionId = session.Id.ToStringInvariant(); String sbAddr = session.Server.GetEndPointForClient(recipient.Socket.LocalEndPoint).ToString(); Command rng = new Command(Verb.Rng, -1, sessionId, sbAddr, "CKI", invitation.Key, caller.User.UserHandle, caller.CustomName); Server.Send(recipient, rng); // I assume this won't be null for small-scale stuff }
public UserListProtocolPacket(byte[] data) { BinaryReader reader = new BinaryReader(new MemoryStream(data), Encoding.UTF8); // Remove command code reader.ReadByte(); int len = IPAddress.NetworkToHostOrder(reader.ReadInt32()); UserList = new UserListEntry[len]; for (int i = 0; i < len; i++) { string userName = reader.ReadString(); string hostName = reader.ReadString(); UserList[i] = new UserListEntry(userName, hostName); } }
// Use this for initialization void Start() { using (SqliteCommand command = new SqliteCommand(Database.DB)) { command.CommandText = "SELECT * FROM users"; using (SqliteDataReader reader = command.ExecuteReader()) { while (reader.Read()) { UserListEntry entry = Instantiate(entryPrefab, transform).GetComponent <UserListEntry>(); entry.gameObject.SetActive(true); entry.Init(reader["username"].ToString(), reader["role"].ToString(), reader["full_name"].ToString()); entries.Add(entry); } } } }
public abstract void ASNotifyAddRL(NotificationConnection recipient, UserListEntry newRLEntry);
public abstract void ASNotifyRng(UserListEntry caller, NotificationConnection recipient, SwitchboardInvitation invitation);