Example #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="newStatus"></param>
 public void OnChangeStatus(OnlineStatus newStatus)
 {
     foreach (IProtocolListener listener in this.listenerList)
     {
         listener.OnChangeStatus(newStatus);
     }
 }
        private void SetOnlineStatus(OnlineStatus status)
        {
            onlineStatus = status;

            switch (status)
            {
            case OnlineStatus.CHECKING:
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    lblConnectionStatus.Content    = "Checking online status. Please wait...";
                    lblConnectionStatus.Foreground = Brushes.Goldenrod;
                }));
                break;

            case OnlineStatus.ONLINE:
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    lblConnectionStatus.Content    = "Online";
                    lblConnectionStatus.Foreground = Brushes.Green;
                }));
                break;

            case OnlineStatus.OFFLINE:
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    lblConnectionStatus.Content    = "Offline";
                    lblConnectionStatus.Foreground = Brushes.Red;
                }));
                break;
            }
        }
Example #3
0
 internal void SendLevel(Level level)
 {
     if (status != OnlineStatus.Identified)
     {
         return;
     }
     this.level = level;
     status     = OnlineStatus.Loading;
     new Thread(
         delegate() {
         Protocol.MapBeginPacket().Send(this);
         byte[] gzipped = Utility.GZipper.GZip(
             BitConverter.GetBytes(
                 IPAddress.HostToNetworkOrder(level.Mapdata.Length)
                 ), level.Mapdata);
         for (int i = 0; i < gzipped.Length; i += 1024)
         {
             byte progress = (byte)((i / 1024 + 1) / Math.Ceiling(gzipped.Length / 1024d) * 100);
             Protocol.MapPartPacket(gzipped, i, progress).Send(this);
         }
         Protocol.MapEndPacket(level.Width, level.Depth, level.Height).Send(this);
         ReadyEvent.Raise(server, this);
         Spawn(level.Spawn);
         foreach (Body b in level.Bodies)
         {
             Protocol.SpawnPacket(b).Send(this);
         }
         Position.Set(level.Spawn);
         Visible = true;
         status  = OnlineStatus.Ready;
         level.players.Add(this);
     }).Start();
 }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="friend"></param>
        /// <param name="status"></param>
        public void OnFriendChangeStatus(Friend friend, OnlineStatus status)
        {
            if (this.Connected)             // ignore any status changes until we have connected
            {
                if (friend.Status == OnlineStatus.Offline)
                {
                    if (GlobalSettings.Instance().PlaySoundOnFriendOnline)
                    {
                        NativeMethods.PlaySoundFromFile(GlobalSettings.Instance().SoundOnFriendOnline,
                                                        PlaySoundFlags.NoDefault | PlaySoundFlags.Asynchronous);
                    }

                    switch (GlobalSettings.Instance().FriendOnlineEvent)
                    {
                    default:
                    case FriendOnlineEvent.DoNothing:
                        break;

                    case FriendOnlineEvent.BalloonToolTip:
                        break;

                    case FriendOnlineEvent.MSNPopUp:
                    {
                        this.taskbarNotify.Invoke(
                            new ShowTaskbarNotifierHandler(ShowTaskbarNotifier),
                            new object[] { "", friend.DisplayName + " (" + friend.Username + ") is Online" });
                    }
                    break;
                    }
                }
            }
        }
        public static QrTestResult Create(
            string pQrCode,
            TypeOfSign pSignType,
            bool pStructureOk,
            bool pUriOk,
            bool pSpacesOk,
            bool pDistrictOk,
            OnlineStatus pIsOnline,
            bool pHasCoordinates,
            bool pIsDuplicate,
            string pMessage,
            bool pHasIssue)
        {
            var mRV = new QrTestResult();

            mRV.QrCode         = pQrCode;
            mRV.SignType       = pSignType;
            mRV.UriOk          = pUriOk;
            mRV.StructureOk    = pStructureOk;
            mRV.DistrictOk     = pDistrictOk;
            mRV.SpacesOk       = pSpacesOk;
            mRV.IsOnline       = pIsOnline;
            mRV.HasCoordinates = pHasCoordinates;
            mRV.IsDuplicate    = pIsDuplicate;
            mRV.HasIssue       = pHasIssue;
            mRV.Messages.Add(pMessage);
            return(mRV);
        }
Example #6
0
    private void OnUserAdd(MessageRouter router, Message message, object tag)
    {
        Regex.Regex regex = new Regex.Regex(@"(?<status>\w+)\s+(?<emailAddress>\S+)\s+(?<screenName>\S+)\s+(?<version>\d+)");
        Regex.Match match = regex.Match(message.Arguments);

        if (match.Success)
        {
            string status       = match.Groups["status"].Value;
            string emailAddress = match.Groups["emailAddress"].Value;
            string screenName   = this.UriUnquote(match.Groups["screenName"].Value);

            OnlineStatus s = this.ConvertStringToStatus(status);

            Friend friend = control.GetFriend(emailAddress);

            if (friend == null)
            {
                friend              = new Friend(emailAddress, s, 0);
                friend.DisplayName  = screenName;
                friend.EmailAddress = emailAddress;
                control.AddFriend(friend);
            }
            else
            {
                friend.Status      = s;
                friend.DisplayName = screenName;
            }
        }
    }
Example #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="status"></param>
 public void OnChangeStatus(OnlineStatus status)
 {
     foreach (StatusMenuItem item in this.statusMenu.MenuItems)
     {
         item.Checked = item.Status == status;
     }
 }
Example #8
0
 public SetStatusRequest(string connection, string accessToken, Guid userID, OnlineStatus onlineStatus, GameStatus gameStatus)
 {
     Connection  = connection;
     AccessToken = accessToken;
     UserID      = userID;
     Status      = ((int)onlineStatus).ToString() + ',' + ((int)gameStatus).ToString();
 }
        public async Task StartAsync(IDialogContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var activity = (IMessageActivity)context.Activity;

            EndUserAndAgentConversationMappingState mappingState =
                await VsoHelper.GetStateFromVsoGivenAgentConversationId(activity.Conversation.Id);

            if (ActivityHelper.HasAttachment(activity))
            {
                await context.PostWithRetryAsync(
                    $"Sending file attachments to user is not supported. " +
                    $"Please send it via SharePoint > Share > Email. Email is in VSO ticket");
            }
            else
            {
                await ActivityHelper.SendMessageToUserEx((IMessageActivity)context.Activity,
                                                         mappingState.EndUserName,
                                                         mappingState.EndUserId,
                                                         activity.Text.Replace(DialogMatches.ReplyToUser + " ", ""),
                                                         mappingState.VsoId);
            }

            await OnlineStatus.SetMemberActive(
                context.Activity.From.Name,
                context.Activity.From.Id,
                OnlineStatus.AgentMemberType);

            context.Done <object>(null);
        }
Example #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="friend"></param>
        /// <param name="newStatus"></param>
        public void OnFriendChangeStatus(Friend friend, OnlineStatus newStatus)
        {
            FriendTreeNode node = (FriendTreeNode)this.friendsTable[friend];

            if (node != null)
            {
                // friend went offline, transfer him to the offline list
                if (friend.Status != OnlineStatus.Offline && newStatus == OnlineStatus.Offline)
                {
                    // move treenode to offline tree
                    this.TreeView.Invoke(new FriendTreeHandler(RemoveFriendFromTree), new object[] { this, node });
                    this.TreeView.Invoke(new FriendTreeHandler(AddFriendToTree), new object[] { this.offlineTreeNode, node });
                }
                // else friend has just came online from being offline
                else if (friend.Status == OnlineStatus.Offline && newStatus != OnlineStatus.Offline)
                {
                    // move treenode from offline tree to protocol tree
                    this.TreeView.Invoke(new FriendTreeHandler(RemoveFriendFromTree), new object[] { this.offlineTreeNode, node });
                    this.TreeView.Invoke(new FriendTreeHandler(AddFriendToTree), new object[] { this, node });
                }

                node.CollapsedImageIndex = node.ExpandedImageIndex = GetFriendNodeImageIndex(newStatus);
                SetFriendToolTip(node, friend.DisplayName, newStatus, friend.EmailAddress);
            }
        }
Example #11
0
        /// <summary>
        /// Sets the protocol image index for the user status.
        /// </summary>
        /// <param name="status"></param>
        private void SetProtocolNodeImageIndex(OnlineStatus status)
        {
            int imageIndex = 3 + (protocolIndex * 9);

            switch (status)
            {
            default:
            case OnlineStatus.Online:
                imageIndex += 1;
                break;

            case OnlineStatus.Idle:
            case OnlineStatus.Away:
                imageIndex += 2;
                break;

            case OnlineStatus.Busy:
                imageIndex += 3;
                break;

            case OnlineStatus.AppearOffline:
            case OnlineStatus.Offline:
                imageIndex += 4;
                break;
            }

            this.ExpandedImageIndex  = imageIndex;
            this.CollapsedImageIndex = imageIndex + 4;
        }
Example #12
0
    public bool SetOnlineStatus(string MemberID, string OnlineStatusString, string CustomMessage)
    {
        InitialiseServerInboxList();
        OnlineStatus newStatus = (OnlineStatus)Enum.Parse(typeof(OnlineStatus), OnlineStatusString, true);

        return(Logic.SetOnlineStatus(MemberID, newStatus, CustomMessage));
    }
Example #13
0
 public User(String appKey, String appSecret)
 {
     this.appKey       = appKey;
     this.appSecret    = appSecret;
     this.block        = new Block(appKey, appSecret);
     this.blackList    = new Blacklist(appKey, appSecret);
     this.onlineStatus = new OnlineStatus(appKey, appSecret);
 }
Example #14
0
 public ListedUser(BaseUser user, OnlineStatus onlineStatus)
 {
     _id               = user._id;
     fullName          = user.fullName;
     status            = user.status;
     identifier        = user.identifier;
     this.onlineStatus = onlineStatus;
 }
Example #15
0
        private OnlineStatus CreateStatus(string code, string desc)
        {
            var os = new OnlineStatus {
                Code = code, Description = desc
            };

            return(os);
        }
Example #16
0
        public ListedUser ReadOneListedById(string id)
        {
            BaseUser     baseUser = ReadOneBaseById(id);
            OnlineStatus status   = ActiveUsers.IsLoggedIn(baseUser._id) ?
                                    OnlineStatus.Online :
                                    OnlineStatus.Offline;

            return(new ListedUser(baseUser, status));
        }
Example #17
0
 public User(string appKey, string appSecret)
 {
     this.appKey    = appKey;
     this.appSecret = appSecret;
     block          = new Block(appKey, appSecret);
     blackList      = new Blacklist(appKey, appSecret);
     onlineStatus   = new OnlineStatus(appKey, appSecret);
     tag            = new Tag(appKey, appSecret);
 }
        public static List <Order> GetAllSellOrders(this ItemOverview marketItem, OnlineStatus onlineStatus)
        {
            var response = RestHelper.Get($"items/{marketItem.UrlName}/orders");
            var config   = ItemOrders_QuickType.FromJson(response.Content);

            var orders = config.Payload.Orders.GetOrdersOfType(OrderType.Sell, onlineStatus);

            return(orders);
        }
Example #19
0
 public FriendStatus Fill(DB_User user, OnlineStatus status)
 {
     ID            = user.ID;
     PlayerID      = 0;
     Status        = status;
     UserName      = user.Name;
     CharacterName = "none";
     return(this);
 }
Example #20
0
		private void OnLogin(byte version,string name,string verify,byte mode) {
			if (status!=OnlineStatus.Connected) { return; }
			this.name = name;
			LoginEvent(this,version,name,verify);
			if (helper.Running) {
				status = OnlineStatus.Identified;
				SendLogin(server.Name,server.Motd,0);
				SendLevel(level);
			}
		}
Example #21
0
 public ClientUser(string userName, string nickName, int age, GenderOption gender,
     string email)
 {
     this.userName = userName;
     this.nickName = nickName;
     this.age = age;
     this.gender = gender;
     this.email = email;
     this.status = OnlineStatus.OFFLINE;
 }
Example #22
0
 /// <summary>
 /// Changes the user's global status
 /// </summary>
 /// <param name="status"></param>
 public void ChangeGlobalStatus(OnlineStatus status)
 {
     foreach (Protocol protocol in this.protocolList)
     {
         if (protocol.Enabled)
         {
             protocol.ChangeStatus(status, new OperationCompleteEvent());
         }
     }
 }
Example #23
0
 public ClientUser(string userName, string nickName, int age, GenderOption gender,
                   string email)
 {
     this.userName = userName;
     this.nickName = nickName;
     this.age      = age;
     this.gender   = gender;
     this.email    = email;
     this.status   = OnlineStatus.OFFLINE;
 }
Example #24
0
 /// <summary>
 ///
 /// </summary>
 public virtual void Load()
 {
     this.enabled          = this.storage.ReadBool("Enabled", false);
     this.username         = this.storage.ReadString("Username", string.Empty);
     this.password         = this.storage.ReadString("Password", string.Empty);
     this.host             = this.storage.ReadString("ServerHost", this.constants.DefaultServerHost);
     this.port             = this.storage.ReadInt32("ServerPort", this.constants.DefaultServerPort);
     this.status           = (OnlineStatus)this.storage.ReadInt32("Status", (int)OnlineStatus.Online);
     this.rememberPassword = this.storage.ReadBool("RememberPassword", false);
 }
Example #25
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="info"></param>
        /// <param name="ctxt"></param>
        public Friend(SerializationInfo info, StreamingContext ctxt)
        {
            this.displayName = info.GetString("DisplayName");
            this.username = info.GetString("Username");
            this.emailAddress = info.GetString("EmailAddress");
            this.blocked = info.GetBoolean("Blocked");

            string groupType = info.GetString("GroupType");
            this.groupIdentifier = info.GetValue("Group", Type.GetType(groupType));

            this.status = OnlineStatus.Offline;
        }
 public static Brush GetStatusColor(OnlineStatus status)
 {
     switch (status)
     {
         case OnlineStatus.Online:
             return Resources.FindResource<SolidColorBrush>("OnlineStatusColor");
         case OnlineStatus.Offline:
             return Resources.FindResource<SolidColorBrush>("OfflineStatusColor");
         default:
             return GraphicsUtil.GetSolidBrush("#ff000000");
     }
 }
Example #27
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <param name="ctxt"></param>
        public Friend(SerializationInfo info, StreamingContext ctxt)
        {
            this.displayName  = info.GetString("DisplayName");
            this.username     = info.GetString("Username");
            this.emailAddress = info.GetString("EmailAddress");
            this.blocked      = info.GetBoolean("Blocked");

            string groupType = info.GetString("GroupType");

            this.groupIdentifier = info.GetValue("Group", Type.GetType(groupType));

            this.status = OnlineStatus.Offline;
        }
Example #28
0
 /// <summary>
 /// Change the user's status
 /// </summary>
 /// <param name="status"></param>
 /// <param name="opCompleteEvent"></param>
 public void ChangeStatus(OnlineStatus status, OperationCompleteEvent opCompleteEvent)
 {
     if (this.isConnected)
     {
         // if connected, change status through protocol
         opCompleteEvent.RegisterEvent(new OperationCompleteHandler(OnStatusChangeComplete), status);
         this.protocol.ChangeStatus(status, opCompleteEvent);
     }
     else
     {
         // else change the initial status
         pChangeStatus(status);
     }
 }
Example #29
0
 public FriendStatus Fill(MasterPlayer player, OnlineStatus status)
 {
     Status        = status;
     ID            = player.User.ID;
     LastOnline    = DateTime.Now;
     PlayerID      = player.Player.Id;
     UserName      = player.User.Name;
     MapName       = player.Player.Room.RoomId;
     CharacterName = player.Char.Pony.Name;
     MapID         = player.Player.Room.Guid.ToString();
     Race          = (CharacterType)player.Char.Pony.Race;
     CutieMarkID   = (short)player.Char.Pony.CutieMark0;
     return(this);
 }
Example #30
0
        public List <ListedUser> ToListed(List <BaseUser> users)
        {
            List <ListedUser> listed = new List <ListedUser>();

            foreach (BaseUser u in users)
            {
                OnlineStatus status = ActiveUsers.IsLoggedIn(u._id) ?
                                      OnlineStatus.Online :
                                      OnlineStatus.Offline;
                listed.Add(new ListedUser(u, status));
            }

            return(listed);
        }
Example #31
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="status"></param>
 public void OnFriendChangeStatus(Friend friend, OnlineStatus status)
 {
     if (friend.Equals(this.originalFriend))
     {
         if (status != OnlineStatus.Offline)
         {
             this.WriteEventToConvoBox(friend.Username + " has changed status to " + status.ToString());
         }
         else
         {
             this.WriteEventToConvoBox(friend.Username + " has signed off");
         }
     }
 }
Example #32
0
 private void OnLogin(byte version, string name, string verify, byte mode)
 {
     if (status != OnlineStatus.Connected)
     {
         return;
     }
     this.name = name;
     LoginEvent(this, version, name, verify);
     if (helper.Running)
     {
         status = OnlineStatus.Identified;
         SendLogin(server.Name, server.Motd, 0);
         SendLevel(level);
     }
 }
Example #33
0
        /// <summary>
        /// Sets the members online status, passing in a custom string if the member desires
        /// </summary>
        /// <param name="MemberID">The memberId to change the status of</param>
        /// <param name="OnlineStatus">The new status</param>
        /// <param name="CustomMessage">Optional custom message</param>
        public static bool SetOnlineStatus(string WebMemberID, OnlineStatus OnlineStatus, string CustomMessage)
        {
            ChatInbox MemberInbox = GetInbox(WebMemberID);

            // check if the user is in the list (not logged in? timed out?)
            if (MemberInbox != null)
            {
                MemberInbox.MemberInfo.OnlineStatus  = OnlineStatus;
                MemberInbox.MemberInfo.CustomMessage = CustomMessage;

                return(true);
            }

            return(false);
        }
Example #34
0
 public void OnDeserialize(NetMessage message)
 {
     Status        = (OnlineStatus)message.ReadByte();
     CharacterName = message.ReadString();
     UserName      = message.ReadString();
     if (Status > OnlineStatus.Offline)
     {
         PlayerID = message.ReadUInt16();
     }
     Race        = (CharacterType)message.ReadInt32();
     ID          = message.ReadInt32();
     CutieMarkID = message.ReadInt16();
     MapName     = message.ReadString();
     MapID       = message.ReadString();
     LastOnline  = message.ReadDateTime();
 }
Example #35
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="status"></param>
 public void OnFriendChangeStatus(Friend friend, OnlineStatus status)
 {
 }
Example #36
0
 public GameDataPacket Receive()
 {
     GameDataPacket packet;
     lock (this)
     {
         lock (receiverLock)
         {
             packet = null;
             try
             {
                 packet = Serializer.DeserializeWithLengthPrefix<GameDataPacket>(DataStream, PrefixStyle.Base128);
             }
             catch (IOException)
             {
                 OnlineStatus = Network.OnlineStatus.Offline;
                 var handler = OnDisconnected;
                 if (handler != null)
                 {
                     OnDisconnected(this);
                 }
                 return null;
             }
             catch (Exception e)
             {
                 Trace.Assert(e != null);
             }
         }
     }
     return packet;
 }
Example #37
0
 public void Send(GameDataPacket packet, bool doRecord = true)
 {
     lock (senderLock)
     {
         DataStream.IsRecordEnabled = doRecord;
         Trace.TraceInformation("ServerGamer : Send {0}({1}) to client {2}", packet.GetType().Name, packet.GetHashCode(), this.GetHashCode());
         Serializer.SerializeWithLengthPrefix<GameDataPacket>(DataStream, packet, PrefixStyle.Base128);
         DataStream.Flush();
     }
     if (!DataStream.IsLastWriteSuccessful && !IsSpectator)
     {
         OnlineStatus = OnlineStatus.Offline;
         var handler = OnDisconnected;
         if (handler != null)
         {
             try
             {
                 OnDisconnected(this);
             }
             catch (Exception) { }
         }
     }
 }
Example #38
0
 public void SetOnlineStatus(int id, OnlineStatus status)
 {
     Trace.Assert(id >= 0);
     if (id < 0) return;
     if (game != null && game.Players.Count > id)
     {
         game.Players[id].OnlineStatus = status;
     }
     Gamers[id].OnlineStatus = status;
     for (int i = 0; i < MaxClients; i++)
     {
         Gamers[i].SendAsync(new OnlineStatusUpdate() { PlayerId = id, OnlineStatus = status } );
     }
 }
Example #39
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="username"></param>
 /// <param name="status"></param>
 /// <param name="groupID"></param>
 public Friend(string username, OnlineStatus status, object groupID)
     : this(username, status)
 {
     this.groupIdentifier = groupID;
 }
Example #40
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="username"></param>
 /// <param name="status"></param>
 public Friend(string username, OnlineStatus status)
 {
     this.username = username;
     this.status = status;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="status"></param>
 public void OnChangeStatus(OnlineStatus status)
 {
     SetProtocolNodeImageIndex(status);
 }
Example #42
0
 /// <summary>
 /// Constructs a status menu item
 /// </summary>
 /// <param name="status">Status to represent</param>
 /// <param name="e">Click event handler</param>
 public StatusMenuItem(OnlineStatus status, EventHandler e)
     : base(status.ToString(), e)
 {
     this.status = status;
 }
Example #43
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="status"></param>
 public void OnFriendChangeStatus(Friend friend, OnlineStatus status)
 {
     if (friend.Equals(this.originalFriend))
     {
         if (status != OnlineStatus.Offline)
             this.WriteEventToConvoBox(friend.Username + " has changed status to " + status.ToString());
         else
             this.WriteEventToConvoBox(friend.Username + " has signed off");
     }
 }
Example #44
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="status"></param>
 public void OnChangeStatus(OnlineStatus status)
 {
 }
Example #45
0
		internal void SendLevel(Level level) {
			if (status!=OnlineStatus.Identified) { return; }
			this.level = level;
			status = OnlineStatus.Loading;
			new Thread(
				delegate() {
					Protocol.MapBeginPacket().Send(this);
					byte[] gzipped = Utility.GZipper.GZip(
						BitConverter.GetBytes(
							IPAddress.HostToNetworkOrder(level.Mapdata.Length)
						),level.Mapdata);
					for (int i=0;i<gzipped.Length;i+=1024) {
						byte progress = (byte)((i/1024+1)/Math.Ceiling(gzipped.Length/1024d)*100);
						Protocol.MapPartPacket(gzipped,i,progress).Send(this);
					} Protocol.MapEndPacket(level.Width,level.Depth,level.Height).Send(this);
					ReadyEvent.Raise(server,this);
					Spawn(level.Spawn);
					foreach (Body b in level.Bodies) { Protocol.SpawnPacket(b).Send(this); }
					Position.Set(level.Spawn);
					Visible = true;
					status = OnlineStatus.Ready;
					level.players.Add(this);
				}).Start();
		}
Example #46
0
 public void LogOff()
 {
     this.status = OnlineStatus.OFFLINE;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="friend"></param>
 /// <param name="status"></param>
 public void OnFriendChangeStatus(Friend friend, OnlineStatus status)
 {
     this.debug.WriteLine("Contact changed status: " + friend.Username);
 }
Example #48
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="status"></param>
 public void OnChangeStatus(OnlineStatus status)
 {
     foreach (StatusMenuItem item in this.statusMenu.MenuItems)
     {
         item.Checked = item.Status == status;
     }
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="status"></param>
 public void OnChangeStatus(OnlineStatus status)
 {
     this.debug.WriteLine("User changed status");
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="friend"></param>
        /// <param name="newStatus"></param>
        public void OnFriendChangeStatus(Friend friend, OnlineStatus newStatus)
        {
            FriendTreeNode node = (FriendTreeNode)this.friendsTable[friend];

            if (node != null)
            {
                // friend went offline, transfer him to the offline list
                if (friend.Status != OnlineStatus.Offline && newStatus == OnlineStatus.Offline)
                {
                    // move treenode to offline tree
                    this.TreeView.Invoke(new FriendTreeHandler(RemoveFriendFromTree), new object[] { this, node });
                    this.TreeView.Invoke(new FriendTreeHandler(AddFriendToTree), new object[] { this.offlineTreeNode, node });
                }
                    // else friend has just came online from being offline
                else if (friend.Status == OnlineStatus.Offline && newStatus != OnlineStatus.Offline)
                {
                    // move treenode from offline tree to protocol tree
                    this.TreeView.Invoke(new FriendTreeHandler(RemoveFriendFromTree), new object[] { this.offlineTreeNode, node });
                    this.TreeView.Invoke(new FriendTreeHandler(AddFriendToTree), new object[] { this, node });
                }

                node.CollapsedImageIndex = node.ExpandedImageIndex = GetFriendNodeImageIndex(newStatus);
                SetFriendToolTip(node, friend.DisplayName, newStatus, friend.EmailAddress);
            }
        }
Example #51
0
 public void LogIn()
 {
     this.status = OnlineStatus.ONLINE;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="newStatus"></param>
 public void OnChangeStatus(OnlineStatus newStatus)
 {
     foreach (IProtocolListener listener in this.listenerList)
     {
         listener.OnChangeStatus(newStatus);
     }
 }
        /// <summary>
        /// Calculates the image index appropriate for the friend's status icon.
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        private int GetFriendNodeImageIndex(OnlineStatus status)
        {
            switch (status)
            {
                default:
                case OnlineStatus.Online:
                    return 0;

                case OnlineStatus.Idle:
                case OnlineStatus.Away:
                    return 1;

                case OnlineStatus.Busy:
                    return 2;

                case OnlineStatus.AppearOffline:
                case OnlineStatus.Offline:
                    return 3 + ((protocolIndex+1) * 9);
            }
        }
Example #54
0
        /// <summary>
        /// Sets the members online status, passing in a custom string if the member desires
        /// </summary>
        /// <param name="MemberID">The memberId to change the status of</param>
        /// <param name="OnlineStatus">The new status</param>
        /// <param name="CustomMessage">Optional custom message</param>
        public static bool SetOnlineStatus(string WebMemberID, OnlineStatus OnlineStatus, string CustomMessage)
        {
           ChatInbox MemberInbox = GetInbox( WebMemberID );

            // check if the user is in the list (not logged in? timed out?)
            if (MemberInbox != null )
            {
                MemberInbox.MemberInfo.OnlineStatus = OnlineStatus;
                MemberInbox.MemberInfo.CustomMessage = CustomMessage;

                return true;
            }

            return false;
        }
 /// <summary>
 /// 
 /// </summary>
 public virtual void Load()
 {
     this.enabled = this.storage.ReadBool("Enabled", false);
     this.username = this.storage.ReadString("Username", string.Empty);
     this.password = this.storage.ReadString("Password", string.Empty);
     this.host = this.storage.ReadString("ServerHost", this.constants.DefaultServerHost);
     this.port = this.storage.ReadInt32("ServerPort", this.constants.DefaultServerPort);
     this.status = (OnlineStatus)this.storage.ReadInt32("Status", (int)OnlineStatus.Online);
     this.rememberPassword = this.storage.ReadBool("RememberPassword", false);
 }
 /// <summary>
 /// Sets the tooltip for the apporpriate node.
 /// </summary>
 /// <param name="node"></param>
 /// <param name="displayName"></param>
 /// <param name="status"></param>
 /// <param name="email"></param>
 private void SetFriendToolTip(TreeNodeEx node, string displayName, OnlineStatus status, string email)
 {
     // change tool tip text
     node.ToolTipText = "Name: " + displayName + "\nStatus: " + status.ToString() + "\nEmail: " + email;
 }
Example #57
0
        public void LoadOptions(GenericReader reader)
        {
            int version = reader.ReadInt();

            if (version >= 3)
                c_MultiC = reader.ReadInt();
            if (version >= 2)
                c_Karma = reader.ReadInt();

            c_ReadReceipt = reader.ReadBool();
            c_QuickBar = reader.ReadBool();
            c_ExtraPm = reader.ReadBool();
            c_Status = (OnlineStatus)reader.ReadInt();

            Mobile m;
            int count = reader.ReadInt();
            for (int i = 0; i < count; ++i)
            {
                m = reader.ReadMobile();
                if (m != null)
                    c_Sounds[m] = reader.ReadInt();
                else
                    reader.ReadInt();
            }

            c_GlobalMC = reader.ReadInt();
            c_GlobalCC = reader.ReadInt();
            c_GlobalGC = reader.ReadInt();
            c_GlobalFC = reader.ReadInt();
            c_GlobalWC = reader.ReadInt();
            c_SystemC = reader.ReadInt();
            c_MsgC = reader.ReadInt();
            c_PerPage = reader.ReadInt();
            c_DefaultSound = reader.ReadInt();
            c_StaffC = reader.ReadInt();
            c_Avatar = reader.ReadInt();
            c_MenuSkin = (Skin)reader.ReadInt();
            c_GlobalAccess = reader.ReadBool();
            c_Global = reader.ReadBool();
            c_GlobalM = reader.ReadBool();
            c_GlobalC = reader.ReadBool();
            c_GlobalG = reader.ReadBool();
            c_GlobalF = reader.ReadBool();
            c_GlobalW = reader.ReadBool();
            c_Banned = reader.ReadBool();
            c_FriendsOnly = reader.ReadBool();
            c_MsgSound = reader.ReadBool();
            c_ByRequest = reader.ReadBool();
            c_FriendAlert = reader.ReadBool();
            c_SevenDays = reader.ReadBool();
            c_WhenFull = reader.ReadBool();
            c_IrcRaw = reader.ReadBool();
            c_AwayMsg = reader.ReadString();
            c_Signature = reader.ReadString();
            c_BannedUntil = reader.ReadDateTime();

            if (c_BannedUntil > DateTime.Now)
                Ban(c_BannedUntil - DateTime.Now);
            else
                RemoveBan();
        }
        /// <summary>
        /// Sets the protocol image index for the user status.
        /// </summary>
        /// <param name="status"></param>
        private void SetProtocolNodeImageIndex(OnlineStatus status)
        {
            int imageIndex = 3 + (protocolIndex * 9);

            switch (status)
            {
                default:
                case OnlineStatus.Online:
                    imageIndex += 1;
                    break;

                case OnlineStatus.Idle:
                case OnlineStatus.Away:
                    imageIndex += 2;
                    break;

                case OnlineStatus.Busy:
                    imageIndex += 3;
                    break;

                case OnlineStatus.AppearOffline:
                case OnlineStatus.Offline:
                    imageIndex += 4;
                    break;
            }

            this.ExpandedImageIndex = imageIndex;
            this.CollapsedImageIndex = imageIndex + 4;
        }