protected void Account_UserStream_Receive(object sender, JsonDocument jdData, UserStream.ReceiveType rtRcvType) { switch (rtRcvType) { case UserStream.ReceiveType.Tweet: case UserStream.ReceiveType.Reply: Status stNewTweet = new Status(jdData.Root.ToNode()); if (!m_twController.ActiveAccount.Statuses.Contains(stNewTweet)) { m_twController.ActiveAccount.Statuses.Add(stNewTweet); if (rtRcvType == UserStream.ReceiveType.Tweet) OnTweetReceived(stNewTweet); else OnReplyReceived(stNewTweet); } break; case UserStream.ReceiveType.DirectMessage: DirectMessage dmNewMessage = new DirectMessage(jdData.Root.ToNode()); m_twController.ActiveAccount.DirectMessages.Add(dmNewMessage); OnDirectMessageReceived(dmNewMessage); break; } }
protected void Account_UserStream_Receive(object sender, JsonDocument jdData, UserStream.ReceiveType rtRcvType) { switch (rtRcvType) { case UserStream.ReceiveType.Tweet: case UserStream.ReceiveType.Reply: Status stNewTweet = new Status(jdData.Root.ToNode()); if (!m_twController.ActiveAccount.Statuses.Contains(stNewTweet)) { m_twController.ActiveAccount.Statuses.Add(stNewTweet); if (rtRcvType == UserStream.ReceiveType.Tweet) { OnTweetReceived(stNewTweet); } else { OnReplyReceived(stNewTweet); } } break; case UserStream.ReceiveType.DirectMessage: DirectMessage dmNewMessage = new DirectMessage(jdData.Root.ToNode()); m_twController.ActiveAccount.DirectMessages.Add(dmNewMessage); OnDirectMessageReceived(dmNewMessage); break; } }
protected virtual void OnDirectMessageReceived(DirectMessage dmReceived) { }
private void CheckMessageType(string data) { try { Tweet tweet = JsonUtility.FromJson <Tweet>(data); if (tweet.text != null && tweet.id_str != null) { messageType = StreamMessageType.Tweet; return; } StreamEvent streamEvent = JsonUtility.FromJson <StreamEvent>(data); if (streamEvent.event_name != null) { messageType = StreamMessageType.StreamEvent; return; } FriendsList friendsList = JsonUtility.FromJson <FriendsList>(data); if (friendsList.friends != null) { messageType = StreamMessageType.FriendsList; return; } DirectMessage directMessage = JsonUtility.FromJson <DirectMessage>(data); if (directMessage.recipient_screen_name != null) { messageType = StreamMessageType.DirectMessage; return; } StatusDeletionNotice statusDeletionNotice = JsonUtility.FromJson <StatusDeletionNotice>(data); if (statusDeletionNotice.delete != null) { messageType = StreamMessageType.StatusDeletionNotice; return; } LocationDeletionNotice locationDeletionNotice = JsonUtility.FromJson <LocationDeletionNotice>(data); if (locationDeletionNotice.scrub_geo != null) { messageType = StreamMessageType.LocationDeletionNotice; return; } LimitNotice limitNotice = JsonUtility.FromJson <LimitNotice>(data); if (limitNotice.limit != null) { messageType = StreamMessageType.LimitNotice; return; } WithheldContentNotice withheldContentNotice = JsonUtility.FromJson <WithheldContentNotice>(data); if (withheldContentNotice.status_withheld != null || withheldContentNotice.user_withheld != null) { messageType = StreamMessageType.WithheldContentNotice; return; } DisconnectMessage disconnectMessage = JsonUtility.FromJson <DisconnectMessage>(data); if (disconnectMessage.disconnect != null) { messageType = StreamMessageType.DisconnectMessage; return; } StallWarning stallWarning = JsonUtility.FromJson <StallWarning>(data); if (stallWarning.warning != null) { messageType = StreamMessageType.StallWarning; return; } messageType = StreamMessageType.None; return; } catch (System.Exception e) { Debug.Log("CheckMessageType Error : " + e.ToString()); messageType = StreamMessageType.None; return; } }
protected override void OnDirectMessageReceived(DirectMessage dmReceived) { }