/// <summary> /// Determine if this device is mentioned in the status post. /// </summary> /// <param name="post"></param> /// <returns></returns> private bool AmIMentioned(StatusPost post) { if (post.Message.ToLower().IndexOf(_username) >= 0) { return true; } return false; }
private bool CheckCommands(StatusPost post) { // Check it's a command, should be 2 parts, who to and command:action // any more than 2 and it's probably not a command string[] userCommand = post.Message.Split(' '); if (userCommand.Length != 2) { return false; } return ProcessCommand(userCommand[1]); }
/// <summary> /// Determine if the status post is sent to us. /// </summary> /// <param name="post"></param> /// <returns></returns> private bool IsPostForMe(StatusPost post) { // If the username is the start of the message then the post // is for us. otherwise ignore if (post.Message.ToLower().IndexOf(_username) == 0) { return true; } return false; }
private void ProcessStatusMessages(ArrayList statusPosts) { foreach (var statusPost in statusPosts) { var post = new StatusPost((Hashtable)statusPost); ProcessStatusMessage(post); _lastPost = post.PostedOn; } }
private void ProcessStatusMessage(StatusPost post) { // Show only posts I am mentioned in if (AmIMentioned(post)) { _loggerDisplay.ShowMessage("@" + post.User.UserName + ":", 10, ReadStatusYPosition); _loggerDisplay.ShowMessage(post.SummaryMessage, 10, ReadStatusYPosition + 20); if (IsPostForMe(post)) { CheckCommands(post); } } }